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
| # /etc/nginx/sites-enabled/go_imaou.conf | |
| server { | |
| listen 80; | |
| server_name go.imaou.com; | |
| location / { | |
| proxy_set_header X-Real-IP $remote_addr; | |
| proxy_set_header Host $http_host; | |
| proxy_pass http://127.0.0.1:32181; | |
| } | |
| } |
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
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <stdint.h> | |
| #include <time.h> | |
| #include <string> | |
| using namespace std; | |
| /**************************************************************** | |
| * |
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
| [ | |
| { | |
| "keys": [ "home" ], | |
| "command": "move_to", | |
| "args": { "to": "bol" } | |
| }, | |
| { | |
| "keys": [ "end" ], | |
| "command": "move_to", | |
| "args": { "to": "eol" } |
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
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| import warnings | |
| import functools | |
| # http://stackoverflow.com/questions/2536307/decorators-in-the-python-standard-lib-deprecated-specifically | |
| def deprecated(func): | |
| """This is a decorator which can be used to mark functions | |
| as deprecated. It will result in a warning being emmitted |
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
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| import requests | |
| from bs4 import BeautifulSoup | |
| def fetch_17173_game_list(): | |
| url = 'http://www.17173.com' | |
| r = requests.get(url) | |
| r.encoding = 'utf-8' |
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 usecases | |
| import ( | |
| "testing" | |
| "time" | |
| . "github.com/smartystreets/goconvey/convey" | |
| ) | |
| type ChanMessage interface { |
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
| const letterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" | |
| const ( | |
| letterIdxBits = 6 // 6 bits to represent a letter index | |
| letterIdxMask = 1<<letterIdxBits - 1 // All 1-bits, as many as letterIdxBits | |
| letterIdxMax = 63 / letterIdxBits // # of letter indices fitting in 63 bits | |
| ) | |
| func RandStringBytesMaskImpr(n int) string { | |
| b := make([]byte, n) | |
| // A rand.Int63() generates 63 random bits, enough for letterIdxMax letters! |
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 chunks(l, n): | |
| """Yield successive n-sized chunks from l.""" | |
| for i in range(0, len(l), n): | |
| yield l[i:i + n] |
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 time | |
| class Timer(object): | |
| def __init__(self, verbose=False): | |
| self.verbose = verbose | |
| def __enter__(self): | |
| self.start = time.time() | |
| return self | |
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 ( | |
| "fmt" | |
| "os" | |
| "runtime" | |
| "time" | |
| ) | |
| // Results of this program on my machine: (macos, go 1.14): |