This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import ( | |
| "github.com/akamensky/argparse" | |
| ) | |
| func main() { | |
| parser := argparse.NewParser("my2go", "Generate GORM models from MySQL database") | |
| // register arguments | |
| host := parser.String("n", "host", &argparse.Options{Required: false, Help: "MySQL host", Default: "localhost"}) | |
| port := parser.Int("p", "port", &argparse.Options{Required: false, Help: "MySQL port", Default: 3306}) | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | package main | |
| import ( | |
| "os" | |
| "go.uber.org/zap" | |
| "go.uber.org/zap/zapcore" | |
| lbj "gopkg.in/natefinch/lumberjack.v2" | |
| ) | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | { | |
| "fmt.Println": { | |
| "prefix": ["pl", "cl", "sout"], | |
| "body": [ | |
| "fmt.Println($1);", | |
| ], | |
| } | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | use std::thread; | |
| use std::time::Duration; | |
| fn main() { | |
| let _ = thread::spawn(|| { | |
| let errmsg = format!("Child thread id {:?} will soon panic.", thread::current().id()); | |
| thread::sleep(std::time::Duration::from_secs(3)); | |
| panic!("{}", errmsg); | |
| }); | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | -- MySQL 8 | |
| drop procedure if exists foofoo; | |
| create procedure foofoo( | |
| params JSON | |
| ) | |
| begin | |
| -- parameters at root level | |
| declare layers JSON; declare total_min, n_layers int unsigned; | |
| -- parameters per layer | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | /** | |
| * Created by Seal.Wu on 2020/7/11 | |
| * Description: Set up mirrors for Gradle Globally | |
| */ | |
| val MAVEN_REPOSITORY_URL = "https://maven.aliyun.com/repository/central" | |
| val JCENTER_REPOSITORY_URL = "https://maven.aliyun.com/repository/jcenter" | |
| val GOOGLE_REPOSITORY_URL = "https://maven.aliyun.com/repository/google" | |
| val GRADLE_PLUGIN_REPOSITORY_URL = "https://maven.aliyun.com/repository/gradle-plugin" | |
| gradle.settingsEvaluated { | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import matplotlib.pyplot as plt | |
| import matplotlib.patches as pch | |
| rec = pch.Rectangle((x1, y1), w, h, linewidth=1, edgecolor='r', facecolor='none') | |
| plt.gca().add_patch(rec) | |
| plt.show() | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | def fibonacci(): | |
| # 如果函数名太长, 为了编码的优雅方便, 建议起个别名. | |
| ctx = fibonacci | |
| # 在if not hasattr代码块里声明并初始化静态局部变量. | |
| # 如果需要用到多个静态局部变量, 只需要检查一个用不到的变量(如ctx.init)是否存在. | |
| # 完成初始化所需的静态局部变量之后, 记得初始化ctx.init. 如此这块代码才不会执行第二次. | |
| if not hasattr(ctx, "init"): | |
| ctx.a0, ctx.a1 = 1, 1 | |
| # ctx.init的赋值是随意的. 我的习惯是赋一个有意义的值. | |
| ctx.init = "<<<Initialized>>>" | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | package main | |
| import ( | |
| "net/smtp" | |
| "log" | |
| "os/exec" | |
| "fmt" | |
| ) | |
| func main() { | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import os | |
| import paramiko | |
| class SftpLogger(object): | |
| def __init__(self, host, port, username, password, basedir='/home/dropbox/'): | |
| ssh = paramiko.SSHClient() | |
| ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) | |
| ssh.connect( | |
| hostname=host, |