gitlab runner 【x509: certificate relies on legacy Common Name field, use SANs instead】 And 【x509: certificate signed by unknown authority】

【x509: certificate relies on legacy Common Name field, use SANs instead】 https://gitlab.com/gitlab-org/gitlab-runner/-/issues/28841 Change all example.com for your domain openssl genrsa -out ca.key 2048 openssl req -new -x509 -days 365 -key ca.key -subj "/C=CN/ST=GD/L=SZ/O=Acme, Inc./CN=Acme Root CA" -out ca.crt openssl req -newkey rsa:2048 -nodes -keyout example.com.key -subj "/C=CN/ST=GD/L=SZ/O=Acme, Inc./CN=*.example.com" -out example.com.csr openssl x509 -req -extfile <(printf "subjectAltName=DNS:example.com,DNS:www.example.com") -days 365 -in example.com.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out example.com.crt Put crt and key to gitlab ssl. Stop gitlab. Start gitlab. Check gitlab have new DNS ...

2023-09-06 · 1 min · 117 words · Me

laravel Socialite line How to

Thanks https://medium.com/laravel-news/adding-auth-providers-to-laravel-socialite-ca0335929e42 This have problems https://socialiteproviders.com/Line/ composer require socialiteproviders/line create app/Providers/LineProvider.php https://github.com/SocialiteProviders/Line/blob/master/Provider.php namespace App\Providers; use GuzzleHttp\RequestOptions; use Laravel\Socialite\Two\InvalidStateException; use \SocialiteProviders\Manager\OAuth2\AbstractProvider; use \SocialiteProviders\Manager\OAuth2\User; class LineProvider extends AbstractProvider { public const IDENTIFIER = 'LINE'; /** * The separating character for the requested scopes. * * @var string */ protected $scopeSeparator = ' '; /** * The scopes being requested. * * @var array */ protected $scopes = [ 'openid', 'profile', 'email', ]; /** * Get the authentication URL for the provider. * * @param string $state * @return string */ protected function getAuthUrl($state) { return $this->buildAuthUrlFromBase( 'https://access.line.me/oauth2/v2.1/authorize', $state ); } /** * Get the token URL for the provider. * * @return string */ protected function getTokenUrl() { return 'https://api.line.me/oauth2/v2.1/token'; } /** * Get the raw user for the given access token. * * @param string $token * @return array */ protected function getUserByToken($token) { $response = $this->getHttpClient()->get( 'https://api.line.me/v2/profile', [ RequestOptions::HEADERS => [ 'Authorization' => 'Bearer '.$token, ], ] ); return json_decode((string) $response->getBody(), true); } /** * Map the raw user array to a Socialite User instance. * * @param array $user * @return \Laravel\Socialite\User */ protected function mapUserToObject(array $user) { return (new User())->setRaw($user)->map([ 'id' => $user['userId'] ?? $user['sub'] ?? null, 'nickname' => null, 'name' => $user['displayName'] ?? $user['name'] ?? null, 'avatar' => $user['pictureUrl'] ?? $user['picture'] ?? null, 'email' => $user['email'] ?? null, ]); } // /** // * Get the POST fields for the token request. // * // * @param string $code // * // * @return array // */ // protected function getTokenFields($code) // { // return array_merge(parent::getTokenFields($code), [ // 'grant_type' => 'authorization_code', // ]); // } /** * @return \SocialiteProviders\Manager\OAuth2\User */ public function user() { if ($this->hasInvalidState()) { throw new InvalidStateException(); } $response = $this->getAccessTokenResponse($this->getCode()); if ($jwt = $response['id_token'] ?? null) { $bodyb64 = explode('.', $jwt)[1]; $user = $this->mapUserToObject(json_decode(base64_decode(strtr($bodyb64, '-_', '+/')), true)); } else { $user = $this->mapUserToObject($this->getUserByToken( $token = $this->parseAccessToken($response) )); } $this->credentialsResponseBody = $response; if ($user instanceof User) { $user->setAccessTokenResponseBody($this->credentialsResponseBody); } return $user->setToken($this->parseAccessToken($response)) ->setRefreshToken($this->parseRefreshToken($response)) ->setExpiresIn($this->parseExpiresIn($response)); } } edit app/Providers/AppServiceProvider.php namespace App\Providers; use Illuminate\Support\ServiceProvider; class AppServiceProvider extends ServiceProvider { /** * Register any application services. */ public function register(): void { // } /** * Bootstrap any application services. */ public function boot(): void { $this->bootLineSocialite(); } public function bootLineSocialite(): void { // // laravel Socialite 和 Socialite Line 有問題,就是 在初始載入不了 // // 看Socialite Line 作者還有在3星期前維謢,所以就不知道怎麼回事 // // https://medium.com/laravel-news/adding-auth-providers-to-laravel-socialite-ca0335929e42 $socialite = $this->app->make('Laravel\Socialite\Contracts\Factory'); $socialite->extend( 'line', function ($app) use ($socialite) { $config = config('services.line'); // https://github.com/SocialiteProviders/Line/blob/master/Provider.php return $socialite->buildProvider(LineProvider::class, $config); // \SocialiteProviders\Line\Provider::class } ); } } routes/web.php Route::get('/auth/redirect', function () { return Socialite::driver('line')->redirect(); }); Route::get('/auth/callback', function () { $user = Socialite::driver('line')->user(); dd($user); });

2023-09-02 · 3 min · 433 words · Me

[轉]美国教授在雅典论坛上,为中国说点公道话,让香港学生差点喘不过气来【视频11分9秒处】

https://www.youtube.com/watch?v=aYTsDSoePGI @tanguemaxime4706 5 個月前 (已編輯) 我出生在中国农村,经历过根植于我记忆中的贫穷;大学之后赴法国学习、生活和工作了15年;后来又在不同的非洲国家工作了多年。我去过30个不同的亚洲、非洲欧洲国家,包括绝大多数东欧国家。我是历史和哲学系出身,我的爱人是哲学本科出身而且硕士和博士都是研究中国政治和法律系统的法国汉学家,她的专业也为了提供了很特别和有价值的视角。我非常赞同这位教授的基本观点: 首先西方一直试图告诉人们这个世界的主要矛盾就是民主和专制的斗争,但是事实远非如此。如果你在非洲最贫困和混乱的国家诸如乍得、中非共和国、马里等地居住过,你才能明白世界的现实究竟是什么。世界的主要矛盾是新自由主义指导下的全球化在世界范围内的不公。这种不公被诸如知识产权、强权利益引导的军事和政治干预等诸多因素决定,在第三世界导致大量的赤贫、污染、动荡。绝大多数国家在全球化分工体系中都不能突破技术壁垒,只能被迫居于工业增值链的最低端。西方霸权会在任何场合提及“民主-独裁”问题,但不会把“每年全世界5岁以下的儿童因饥饿和营养不良死亡3到5百万”这个问题放在人类亟待解决的首位。因为对后者的分析才会揭示这个世界真正的主要矛盾在哪里,会动摇西方主导的全球化秩序。这个世界的基础是财富的创造(生产力)和财富的分配机制(生产关系),很多发达世界的年轻人根本没承受过真正的苦难,被西方政治宣传洗脑的香港年轻人也是这样,就像温室里的花,以为“民主”是一切病症的中心,说出来的都是那种“何不食肉糜”的蠢话。 第二,民主或者不民主本来就是一个非常复杂而且在历史中不断变动的概念。这些东西是“理念”,而不是可以客观观察的“一只猫”或者“一条狗”,其内涵不是不变的,而是不同时代的人们反思他们的时代,从而为其不断注入或者减去内涵。熊彼得之前和熊彼得之后的民主能是一样的吗?希腊的民主和当代的民主是一样的吗?这个教授说的很好,政治形式更值得关注的是细节,有那么多细节需要讨论和关注。要真正讨论民主自由这些东西,你至少要从古希腊、博丹、格劳秀斯、启蒙运动、康德、黑格尔一路读到以赛亚柏林、波普、熊彼得。但是这太难了,对于那些只知道喊口号的懒惰的年轻人而言。 第三,历史传统。我记得以前上学的时候有个法国教授跟我们说:如果西方对于中国的政治史有一些基本了解的话,那么就应该谦虚一些。中国唐代中书、门下、尚书省和皇帝在诏书的颁布和实施就已经非常具有严谨的制衡机制;谏台、监察等制度;中央和地方的关系、军制、劳役和税制等等,都是复杂和让人惊叹的严谨。很多知识匮乏的年轻人就觉得西方那套照搬到什么地方都好用,完全看不到这套制度在绝大多数地方的运行都是失败的。实际上,政治制度之于政治文化就像一个外壳、表象,或者冰山露出水面的部分。没有外力干扰的情况下,政治文化会自然的孕育政治制度。而政治文化是民族千百年来积累下来的、有机态的生长的结果。它是根植于血肉和土地的东西。比如利比亚,就是独特的历史和地理环境造成了这个国家以贝都因人部族为单位形成了一个复杂的制衡、联姻、竞争的权力和利益分配体。这是深层的政治文化,产生于千百年来“人”和“历史”、“地理”、“生产技术”的磨合。西方要在利比亚搞西方民主,那就是个表皮,这个表皮下面继续运作的还是原来的政治文化。西方的制度之所以在西方适合也是因为他们经历了一千多年从中世纪以来特别是200多年以来的各种摸索和磨合建立起来的,很多西方政治的机制都能在中世纪甚至更早的时代找到根源。政治制度的有效运行需要同历史、经济现实以及政治文化相契合。 最后,我想补充一点个人的看法。中国人并非一个封闭的民族,我们从古至今都不排斥学习别的民族。民主、自由、公平、正义、主权在民等等现代政治学的理念我们并不排斥。马克思也是西方的,中国排斥了吗?我们反对的是将它们神话,或者形而上学化。 周虽旧邦其命维新,古老的中华民族之所以能够穿越几千年还能保持其活力,根本就在于能够同时兼顾两个方面,即“接受新鲜的合理事物”同时又能“不失其本体”。 孙中山接受了民族主义,但是能很快适应中国的现实转而宣传“五族共和-中华民族”;毛泽东的革命胜利建立在对于马克思主义的修正使其的中国化,反对“教条主义”,走农村路线,而不是死板地依靠工人阶级;邓小平的改革开放也是将西方的市场经济融入马克思理论。一个民族但凡对于自身的智慧有一点信心,也要会动动脑子,不至于像个脑瘫一样照囫囵吞枣,闭着眼睛搬照抄别人的。

2023-08-13 · 1 min · 12 words · Me

set alpine data out side of the component

https://tonylea.com/setting-alpine-data-outside-of-the-component <div x-data="{good_id: '', good_name: ''}" id="good_info" class="w-full" @set_good_data=" good_id = $event.detail.good_id; good_name = $event.detail.good_name; "> <div x-text="good_id"></div> <div x-text="good_name"></div> </div> <script> document.getElementById('good_info').dispatchEvent(new CustomEvent('set_good_data', { detail: { good_id: 1234, good_name: 'Apple', } })); </script>

2023-07-25 · 1 min · 34 words · Me

Laravel Livewire with WinNMP Part II

https://github.com/sueboy19/livewire_demo

2023-06-04 · 1 min · word · Me

Laravel Livewire with WinNMP

winnmp for windows a. create project livewire (Database and user auto create livewire) b. https://winnmp.wtriple.com/tutorial/laravel update composer a. mkdir new directory "t" b. cd t c. https://getcomposer.org/download/ c1. php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" c2. php -r "if (hash_file('sha384', 'composer-setup.php') === '55ce33d7678c5a611085589f1f3ddf8b3c52d662cd01d4ba75c0ee0459970c2200a51f492d557530c71c15d8dba01eae') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" c3. php composer-setup.php c4. php -r "unlink('composer-setup.php');" c5. mv composer.phar to C:\WinNMP\bin\composer cd \WinNMP\WWW\livewire a. delete index.php b. composer create-project --prefer-dist laravel/laravel . c. composer require laravel/ui d. composer install e. edit .env e1. DB_DATABASE=livewire DB_USERNAME=livewire f. php artisan ui bootstrap --auth g. php artisan migrate h. developer tools composer require doctrine/dbal composer require --dev barryvdh/laravel-ide-helper composer require --dev beyondcode/laravel-dump-server composer require --dev barryvdh/laravel-debugbar composer require --dev roave/security-advisories:dev-master php artisan vendor:publish --provider="BeyondCode\DumpServer\DumpServerServiceProvider" php artisan vendor:publish --provider="Barryvdh\Debugbar\ServiceProvider" I. php artisan key:generate install node.js for windows a. https://nodejs.org/zh-tw/download b. npm install c. npm run dev ...

2023-06-03 · 2 min · 249 words · Me

Codeigniter 4.2 with Eloquent ORM

composer require "illuminate/database" composer require "illuminate/events" Config/Events.php use Illuminate\Database\Capsule\Manager as Capsule; use Illuminate\Events\Dispatcher; use Illuminate\Container\Container; function boostEloquent() { $capsule = new Capsule; $capsule->addConnection([ 'driver' => 'mysql', 'host' => 'localhost', 'database' => 'database', 'username' => 'root', 'password' => 'password', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', ]); // Set the event dispatcher used by Eloquent models... (optional) $capsule->setEventDispatcher(new Dispatcher(new Container)); // Make this Capsule instance available globally via static methods... (optional) $capsule->setAsGlobal(); // Setup the Eloquent ORM... (optional; unless you've used setEventDispatcher()) $capsule->bootEloquent(); } Events::on('pre_system', function () { boostEloquent(); if (ENVIRONMENT !== 'testing') ... } https://www.modb.pro/db/49966

2023-05-08 · 1 min · 97 words · Me

golang gin windows service

Golang Gin Api become Windows Service Use github.com/kardianos/service package main import ( "errors" "fmt" "io" "log" "net" "net/http" "os" "path/filepath" "strings" "time" "github.com/gin-gonic/gin" "github.com/joho/godotenv" "github.com/kardianos/service" ) // Process Windows Service // github.com/kardianos/service var logger service.Logger type program struct{} func (p *program) Start(s service.Service) error { // Start should not block. Do the actual work async. go p.run() return nil } func (p *program) Stop(s service.Service) error { // Stop should not block. Return with a few seconds. return nil } func ExecPath() string { ex, err := os.Executable() if err != nil { panic(err) } exPath := filepath.Dir(ex) return exPath } func main() { File, err := os.Create(ExecPath() + "\\gin_service_run.log") if err != nil { File = os.Stdout } defer File.Close() log.SetOutput(File) var s service.Service svcConfig := service.Config{ Name: "GinAPI", DisplayName: "Gin API Service", Description: "Gin API Server Converter Windows Service", } prg := &program{} s, err = service.New(prg, &svcConfig) if err != nil { log.Fatalln(err) } logger, err = s.Logger(nil) if err != nil { log.Fatalln(err) } if len(os.Args) > 1 { switch os.Args[1] { case "install": err := s.Install() if err != nil { logger.Errorf("Install Service Fail!", err.Error()) return } fmt.Printf("Install Service Success!") case "uninstall": err := s.Uninstall() if err != nil { logger.Errorf("Uninstall Service Fail!", err.Error()) return } fmt.Printf("Uninstall Service Success!") case "start": err := s.Start() if err != nil { logger.Errorf("Start Service Fail!", err.Error()) return } fmt.Printf("Start Service Success!") case "stop": err := s.Stop() if err != nil { logger.Errorf("Stop Service Fail!", err.Error()) return } fmt.Printf("Stop Service Success!") } return } err = s.Run() if err != nil { logger.Error(err) } } func (p *program) run() { // // Create Error logger // errFile, err := os.OpenFile(ExecPath()+"\\errors.log", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666) if err != nil { log.Fatalf("打開日誌文件失敗:", err) } Error = log.New(io.MultiWriter(errFile, os.Stderr), "【Error】", log.Ldate|log.Ltime|log.Lshortfile) // // Get .env // err = godotenv.Load(ExecPath() + "\\.env") if err != nil { msg := "找不到 .env 檔案" logger.Errorf(msg, err) Error.Printf(msg, err) } web_port := os.Getenv("WEB_PORT") // // Start Gin // router := gin.Default() corsConfig := cors.DefaultConfig() corsConfig.AllowAllOrigins = true router.Use(cors.New(corsConfig)) router.GET("/", func(c *gin.Context) { c.JSON(http.StatusOK, gin.H{"status": "Gin Api Success!"}) }) log.Fatal(http.ListenAndServe(":"+web_port, router)) } 1. run server.exe can run Gin Api Server right now. 2. run server install, server uninstall, server start, server stop. 2.1 【Install and Start】run server install Then server start 2.2 【Stop and uninstall】run server stop Then server uninstall 3. log file use absolute path. ExecPath() can get absolute path. 4. .env must use absolute path. Try to use svcConfig.EnvVars = map[string]string{ "WEB_PORT": web port } see register Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\GinAPI have EnvVars Data. But err := godotenv.Load() can’t get anything, just No Error. So must use absolute path. ...

2023-01-11 · 3 min · 472 words · Me

Codeigniter 4 ORM relation By hand Part 2

Modify ModelTrait file at \App\Traits namespace App\Traits; trait ModelTrait { // fetaure Maybe belongsTo // get result but not effect this, keep this ORM status public function newSelfObject() { return $this->db->query($this->builder->getCompiledSelect(false)); } // copy self object return ORM Object public function cso() { $class_name = get_class($this); $class_new_object = (new $class_name); $class_new_object->builder = clone $this->builder; return $class_new_object; } public function hasOne($class, $relation_primary_key=null, $primary_key=null) { return $class->where($relation_primary_key ?? $this->primaryKey, $this->newSelfObject()->getRowArray()[$primary_key ?? $this->primaryKey] ?? ''); } // whereIn If can't get records, return null. Usually use primaryKey cloud happen public function hasMany($class, $relation_primary_key=null, $primary_key=null) { $temp = array_column($this->newSelfObject()->getResult(), $primary_key ?? $this->primaryKey); return $class->whereIn($relation_primary_key ?? $this->primaryKey, empty($temp) ? [null] : $temp); } } App\Controllers\OrderListContriller.php ...

2022-12-29 · 1 min · 147 words · Me

localhost.run 單純快速測試反向

https://localhost.run/docs/

2022-11-30 · 1 min · word · Me

Codeigniter 4 ORM relation By hand

Add ModelTrait file at \App\Traits namespace App\Traits; trait ModelTrait { // fetaure Maybe belongsTo // get result but not effect this, keep this ORM status public function newSelfObject() { return $this->db->query($this->builder->getCompiledSelect(false)); } public function hasOne($class, $relation_primary_key=null, $primary_key=null) { return $class->where($relation_primary_key ?? $this->primaryKey, $this->newSelfObject()->getRowArray()[$primary_key ?? $this->primaryKey] ?? ''); } // whereIn If can't get records, return null. Usually use primaryKey cloud happen public function hasMany($class, $relation_primary_key=null, $primary_key=null) { $temp = array_column($this->newSelfObject()->getResult(), $primary_key ?? $this->primaryKey); return $class->whereIn($relation_primary_key ?? $this->primaryKey, empty($temp) ? [null] : $temp); } } How to use App\Models\Order.php class Order extends Model { use ModelTrait; protected $table = 'order'; protected $primaryKey = 'order_id'; public function members() { return $this->hasMany(new Member); // OR return $this->hasMany(new Member, 'id', 'member_id'); // id always use new Member, member_id use Order } App\Controllers\OrderListContriller.php ...

2022-11-22 · 1 min · 201 words · Me

SeckillSolution 秒殺 高并發 交易

https://github.com/qianshou/SeckillSolution https://blog.csdn.net/koastal/article/details/78995885 ===== https://blog.csdn.net/qq_38512763/article/details/118830903

2022-09-30 · 1 min · 4 words · Me

Aggregate array values into ranges

https://codereview.stackexchange.com/questions/80080/aggregate-array-values-into-ranges // Output: // Array ( // [0] => Array ( [0] => 1, [1] => 2, [2] => 3, [3] => 4, [4] => 5, [5] => 6 ) // [1] => Array ( [0] => 10, [1] => 11, [2] => 12, [3] => 13 ) // [2] => Array ( [0] => 20 ) // [3] => Array ( [0] => 24 ) // ) static function GetRanges1( $aNumbers ) { $aNumbers = array_unique( $aNumbers ); sort( $aNumbers ); $aGroups = array(); for( $i = 0; $i < count( $aNumbers ); $i++ ) { if( $i > 0 && ( $aNumbers[$i-1] == $aNumbers[$i] - 1 )) array_push( $aGroups[count($aGroups)-1], $aNumbers[$i] ); else array_push( $aGroups, array( $aNumbers[$i] )); } return $aGroups; } // Output: Array ( [0] => 1-6, [1] => 10-13, [2] => 20, [3] => 24 ) static function GetRanges2( $aNumbers ) { $aNumbers = array_unique( $aNumbers ); sort( $aNumbers ); $aGroups = array(); for( $i = 0; $i < count( $aNumbers ); $i++ ) { if( $i > 0 && ( $aNumbers[$i-1] == $aNumbers[$i] - 1 )) array_push( $aGroups[count($aGroups)-1], $aNumbers[$i] ); else array_push( $aGroups, array( $aNumbers[$i] )); } $aRanges = array(); foreach( $aGroups as $aGroup ) { if( count( $aGroup ) == 1 ) $aRanges[] = $aGroup[0]; else $aRanges[] = $aGroup[0] . '-' . $aGroup[count($aGroup)-1]; } return $aRanges; } // Output: 1~6,10~13,20,24 static function GetRanges3( $aNumbers, $headChar='' ) { $aNumbers = array_unique( $aNumbers ); sort( $aNumbers ); $aGroups = array(); for( $i = 0; $i < count( $aNumbers ); $i++ ) { if( $i > 0 && ( $aNumbers[$i-1] == $aNumbers[$i] - 1 )) array_push( $aGroups[count($aGroups)-1], $aNumbers[$i] ); else array_push( $aGroups, array( $aNumbers[$i] )); } $aRanges = array(); foreach( $aGroups as $aGroup ) { if( count( $aGroup ) == 1 ) $aRanges[] = $headChar.$aGroup[0]; else $aRanges[] = $headChar.$aGroup[0] . '~' . $headChar.$aGroup[count($aGroup)-1]; } return implode( ',', $aRanges ); }

2022-09-23 · 2 min · 313 words · Me

[轉]疫情

2022-05-20 · 0 min · 0 words · Me

gorm manytomany many2many use go program

type RoleHasPermissionList struct { model.Roles Rolehaspermissions []CUS_Rolehaspermissions `json:"rolehaspermissions" gorm:"foreignkey:role_id; references:id"` } type CUS_Rolehaspermissions struct { PermissionId int `json:"-"` RoleId int `json:"-"` PermissinInfo model.Permission `gorm:"foreignkey:id; references:permission_id"` } func (CUS_Rolehaspermissions) TableName() string { return "RoleHasPermissions" } type FormaterResult struct { model.Roles Permission []model.Permission `json:"permission"` } func GetRoleList(c *gin.Context) serializer.Response { var req GetRoleListRequest c.ShouldBind(&req) var total int64 var list []RoleHasPermissionList page := req.Page pageSize := req.PageSize model.DB. Scopes(util.Paginate(c, page, pageSize)). Preload("Rolehaspermissions.PermissinInfo"). Find(&list).Offset(-1).Limit(-1).Count(&total) // 重新整理輸出格式 var formater_result []FormaterResult for i, v := range list { formater_result = append(formater_result, FormaterResult{Roles: v.Roles}) for _, v2 := range v.Rolehaspermissions { formater_result[i].Permission = append(formater_result[i].Permission, v2.PermissinInfo) } } return serializer.Response{ Code: 0, Message: "成功", Data: util.Pagination(c, page, pageSize, total, formater_result), } } { "id": 1, "name": "company", "display_name": "公司", "guard_name": "admin_api", "created_at": "2020-03-26 14:34:25", "updated_at": "2020-03-26 14:34:25", "permission": [ { "id": 1, "name": "add company", "display_name": "add company", "guard_name": "admin_api", "created_at": "2020-03-26 14:34:25", "updated_at": "2020-03-26 14:34:25" }, { "id": 2, "name": "edit company", "display_name": "edit company", "guard_name": "admin_api", "created_at": "2020-03-26 14:34:25", "updated_at": "2020-03-26 14:34:25" }, ] }, ...

2022-05-19 · 1 min · 170 words · Me

bytes32[] remix solidity

// SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.7.0 <0.9.0; contract Fix { bytes32[] questionList= [ bytes32(0x52a6eb687cd22e80d3342eac6fcc7f2e19209e8f83eb9b82e81c6f3e6f30743b), bytes32(0x257f3de9149acf0a49d3f7668956aeb52490202fae9ec2e92c3caa7d5223c6ef) ]; // constructor() { // // questionList = [ // // bytes32(0x52a6eb687cd22e80d3342eac6fcc7f2e19209e8f83eb9b82e81c6f3e6f30743b), // // bytes32(0x257f3de9149acf0a49d3f7668956aeb52490202fae9ec2e92c3caa7d5223c6ef) // // ]; // } // function addQuestion(bytes32 questionKey) // public // returns(bool success) // { // questionList.push(questionKey); // return true; // } function getQuestionCount() public view returns(uint questionCount) { return questionList.length; } function getQuestionAtIndex(uint row) public view returns(bytes32 questionkey) { return questionList[row]; } }

2022-05-11 · 1 min · 75 words · Me

[轉]After 5 years, I am out of the serverless compute cult

https://dev.to/brentmitchell/after-5-years-im-out-of-the-serverless-compute-cult-3f6d I have been using serverless computing and storage for nearly five years and I’m finally tired of it. I do feel like it has become a cult. In a cult, brainwashing is done so gradually, people have no idea it is going on. I feel like this has happened across the board with so many developers; many don’t even realize they are clouded. In my case, I took the serverless marketing and hype hook, line, and sinker for the first half of my serverless journey. After working with several companies small and large, I have been continually disappointed as our projects grew. The fact is, serverless technology is amazingly simple to start, but becomes a bear as projects and teams accelerate. A serverless project typically includes a fully serverless stack which can include (using a non-exhaustive list of AWS services): ...

2022-04-29 · 9 min · 1784 words · Me

jenkins withCredentials sshUserPrivateKey

https://codeleading.com/article/11015806881/. Remeber sshCommand remote, remote infos have identityFile. identityFile need be at insdie identity. Don’t understand identity be keep. Only can be used inside identity def getRemoteHost(ip, user) { def remote = [:] remote.name = ip remote.host = ip remote.user = user remote.identityFile = identity remote.port = 22 remote.allowAnyHosts = true return remote } pipeline { agent any environment { ssh_ip = 'ooo.xxx.ooo.xxx' ssh_user = 'ubuntu' ssh_jenkins_key_uid = 'oooooooo-xxxx-xxxx-xxxx-oooooooooooo' // SSH_CREDS = credentials('oooooooo-xxxx-xxxx-xxxx-oooooooooooo') } stages { stage('ssh Command'){ steps { withCredentials([sshUserPrivateKey(credentialsId: "${ssh_jenkins_key_uid}", keyFileVariable: 'identity')]) { sshCommand remote: getRemoteHost(ssh_ip, ssh_user), command: "echo" //在远程服务器执行echo命令 } } } } } def runCommand(cmd) { def remote = [:] remote.name = "${ssh_ip}" remote.host = "${ssh_ip}" remote.user = "${ssh_user}" // remote.identityFile = identity remote.port = 22 remote.allowAnyHosts = true withCredentials([sshUserPrivateKey( credentialsId: "${ssh_jenkins_key_uid}", keyFileVariable: 'identity')]) { remote.identityFile = identity sshCommand remote: remote, command: cmd } } pipeline { agent any environment { ssh_ip = 'ooo.xxx.ooo.xxx' ssh_user = 'ubuntu' ssh_jenkins_key_uid = 'oooooooo-xxxx-xxxx-xxxx-oooooooooooo' // SSH_CREDS = credentials('oooooooo-xxxx-xxxx-xxxx-oooooooooooo') } stages { stage('ssh Command') { steps { echo 'whoami start...' runCommand('whoami') echo 'whoami success' } } } }

2022-04-21 · 1 min · 177 words · Me

model y 車機掛幾次

保养花费差7倍?特斯拉Model Y蔚来EC6《真十万公里长测》报告 7 Times in Maintenance costs? Tesla Model Y vs NIO EC6 Test https://youtu.be/UrCEOMQPRzk?t=1052 17:32

2022-04-15 · 1 min · 16 words · Me

【事實釐清】媒體報導「歐盟主要成員國近日同意將核能納入『綠色轉型』,成為解決碳排放的一環;希望各國利用核能,趕在2050年前實現碳中和」?

【事實釐清】媒體報導「歐盟主要成員國近日同意將核能納入『綠色轉型』,成為解決碳排放的一環;希望各國利用核能,趕在2050年前實現碳中和」? https://tfc-taiwan.org.tw/articles/2192 黃其君 ✔正常查核程序: 優先翻閱一手資料,若不懂則請教專家 ✖ TFC 台灣事實查核中心: 請教(有偏見)專家,也無對專家言論做查對 然後第一個說核能列入歐盟綠色轉型的不是台灣報導也不是哪個擁核媒體平台,是世界最大的媒體通訊社,美聯社以《EU leaders include nuclear energy in green transition》為標題報導歐盟高峰會結論,然後有紐約時報、日本時報等轉載刊登,到台灣因為翻譯就變成歐盟將核能納入綠色轉型。不懂台灣反核怎麼一直說別人世界最大平台假消息呢? ▉美聯社 https://reurl.cc/5gmyV6 范建德老師以2020/01/10的法案文字來認定歐盟要非核,但1/10有好多版本討論,法案文字都不是最終版,反核的還是綠黨提的…裏頭還要求2030歐盟要非核無煤阿…所以最後全部被刪光光也不意外。 ▉法案文字 2020/01/15(無反核定案版) https://reurl.cc/RdNl3Z 2020/01/10(無反核草案) https://reurl.cc/4gx79v 2020/01/10(反核草案) https://reurl.cc/Gk1R2v 而台大風險中心趙研究員真的讓你看看什麼叫超譯… 歐盟的技術文件裡提到核能在低碳能源中的重要腳色顯而易見,但確實在風險管理例如核廢料上難以將do no harm排除,很重要的一點,他有表明是因為現階段尚無啟用的核發電燃料的深層處置設施,所以無實例可以做評估。該報告也會在近一步針對核能做詳細討論。 並非像趙研究員說的什麼沒有解方或要隔絕數百萬年…可以不要自己腦補嗎?明明裏投也跟你說有解法了… ▉報告這邊看 https://reurl.cc/9zlYz8 Regarding the long-term management of High-Level Waste (HLW), there is an international consensus that a safe, long-term technical solution is needed to solve the present unsustainable situation. A combination of temporary storage plus permanent disposal in geological formation is the most promising, with some countries are leading the way in implementing those solutions. Yet nowhere in the world has a viable, safe and long-term underground repository been established. It was therefore infeasible for the TEG to undertake a robust DNSH assessment as no permanent, operational disposal site for HLW exists yet from which long-term empirical, in-situ data and evidence to inform such an evaluation for nuclear energy. ...

2022-02-07 · 2 min · 236 words · Me