- intro, download, install & setup
- basics, syntax
- control flow
- more types, data structures
- methods & interfaces
- concurrency
- nice to know stuff
- golang gotchas <-- especially if you are coming from python, ruby etc
- workspace
This file contains 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
upstream myapp { | |
server 127.0.0.1:8081; | |
} | |
limit_req_zone $binary_remote_addr zone=login:10m rate=1r/s; | |
server { | |
listen 443 ssl spdy; | |
server_name _; | |
This file contains 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
#include <arpa/inet.h> | |
#include <asm/byteorder.h> | |
#include <assert.h> | |
#include <errno.h> | |
#include <net/ethernet.h> | |
#include <netinet/ether.h> | |
#include <netinet/icmp6.h> | |
#include <netinet/ip6.h> | |
#include <stdio.h> | |
#include <stdlib.h> |
This file contains 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
func main() { | |
cmd := exec.Command("sh", "-c", "cd ../../bin/worker; ./run.sh") | |
// some command output will be input into stderr | |
// e.g. | |
// cmd := exec.Command("../../bin/master_build") | |
// stderr, err := cmd.StderrPipe() | |
stdout, err := cmd.StdoutPipe() | |
if err != nil { | |
fmt.Println(err) | |
} |
This file contains 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
#!/bin/bash | |
PREFIX="$1" | |
IFACE="$2" | |
ip netns add jool | |
ip link add name to_jool typ veth peer name to_world | |
ip link set up dev to_jool | |
ip link set dev to_world netns jool | |
ip netns exec jool ip link set up dev to_world |
This file contains 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 ( | |
"io" | |
"log" | |
"net" | |
"net/http" | |
"sync" | |
) |
Have you ever stuck in a condition where you have to restore your mysql database from only an *.frm and *.ibd files? I have.
So what happen is somehow our mysql service is going down and can not be restarted. I try many things to no avail and getting tired of it.
And then I came across this page https://dev.mysql.com/doc/mysql-enterprise-backup/3.11/en/partial.restoring.single.html. I think probably I can just copy the *.frm and *.ibd file, wipe the current mysql data, reset the mysql, and restore those two files. Easy.
So I stupidly remove /var/lib/mysql/[schema_name]
, and also /var/lib/mysql/ib*
file. Restart the mysql, and it start normally. Finally!
This file contains 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 ( | |
"fmt" | |
"io" | |
"net" | |
"net/http" | |
"syscall" | |
) |
This file contains 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
const puppeteer = require("puppeteer-core"); // v13.0.0 or later | |
const path = require("path"); | |
(async () => { | |
const browser = await puppeteer.launch({ | |
executablePath: | |
"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe", | |
}); | |
const page = await browser.newPage(); | |
const timeout = 5000; |