Skip to content

Instantly share code, notes, and snippets.

@iamxy
iamxy / show_table_space_usage.sh
Created May 20, 2018 09:09
A shell script to get and show disk space usage of tables in specified database of TiDB
#!/usr/bin/env bash
# Copyright 2018 PingCAP, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@j-iNFINITE
j-iNFINITE / 百度云盘批量转存用户分享
Created February 29, 2016 06:00
百度云盘批量转存用户分享
/**
* 贪灵Gollum for Baiduyun, Ver.3.4.4
* 立即执行函数:百度云盘批量转存用户分享。
*
* 【特点】
* - 可保持或无视原分享者的目录结构。
* - 支持差分转存。
* - 自动分解转存,可突破单次转存总文件数5000的限制。
* - 可在分享主页下,进入某文件夹来转存其下级子文件夹。
* - 支持专辑转存。
@evalphobia
evalphobia / atoi_test.go
Last active March 28, 2025 12:42
golang benchmark: String and Int conversions
package bench
import (
"strconv"
"testing"
)
var smallStr = "35"
var bigStr = "999999999999999"
@cloverstd
cloverstd / app.py
Last active November 4, 2019 21:33
微信二维码扫描登录
#!/usr/bin/env python
# encoding: utf-8
import tornado.ioloop
import tornado.httpclient
import tornado.web
import tornado.gen
import json
import tornado.websocket
import Queue
package main
import (
"net/http"
"database/sql"
"fmt"
"log"
"os"
)
@lyoshenka
lyoshenka / ngrok-selfhosting-setup.md
Last active February 21, 2025 08:33
How to setup Ngrok with a self-signed SSL cert

Intro

The plan is to create a pair of executables (ngrok and ngrokd) that are connected with a self-signed SSL cert. Since the client and server executables are paired, you won't be able to use any other ngrok to connect to this ngrokd, and vice versa.

DNS

Add two DNS records: one for the base domain and one for the wildcard domain. For example, if your base domain is domain.com, you'll need a record for that and for *.domain.com.

Different Operating Systems

@josephturnerjr
josephturnerjr / app.py
Created March 20, 2014 20:16
Example of stateless (no database) password resets in Python / Flask
from flask import Flask, request
import hmac
import urllib
import json
app = Flask(__name__)
app.secret_key = 'THIS IS A SECRET KEY (JUST KIDDING)'
def get_auth_code(payload):
@khoden
khoden / nginx_codes_stat.py
Last active September 19, 2024 11:54
HTTP-status code statistic from nginx access log
#! /usr/bin/env python
import argparse
import sys
import re
import time
line_nginx_full = re.compile(r"""(?P<ipaddress>\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}) - - \[(?P<dateandtime>\d{2}\/[a-z]{3}\/\d{4}:\d{2}:\d{2}:\d{2} (\+|\-)\d{4})\] ((\"(GET|POST) )(?P<url>.+)(http\/1\.1")) (?P<statuscode>\d{3}) (?P<bytessent>\d+) (["](?P<refferer>(\-)|(.+))["]) (["](?P<useragent>.+)["])""",
re.IGNORECASE)
line_nginx_onlyStatus = re.compile(r'.+HTTP\/1\.1" (?P<statuscode>\d{3})')
@yorkxin
yorkxin / rfc6750.md
Created September 17, 2013 07:54
RFC 6750 in Markdown - Edited from http://tools.ietf.org/rfc/rfc6750.txt
Internet Engineering Task Force (IETF)                          M. Jones
Request for Comments: 6750                                     Microsoft
Category: Standards Track                                       D. Hardt
ISSN: 2070-1721                                              Independent
                                                            October 2012

The OAuth 2.0 Authorization Framework: Bearer Token Usage

Abstract

@dwayne
dwayne / ch0.md
Last active August 9, 2020 07:57
My notes from the book "Working with TCP Sockets by Jesse Storimer"

Chapter 0

Network programming is ultimately about sharing and communication.

Audience: Ruby devs on Unix or Unix-like systems.

Uses Ruby 1.9.

Part 1 - Introduction to the primitives of Socket programming