Skip to content

Instantly share code, notes, and snippets.

View tzwm's full-sized avatar
☠️
……

Samwise Wang tzwm

☠️
……
  • nieta
  • Latent Space
  • 09:43 (UTC +08:00)
  • X @tzwm
View GitHub Profile
@chuangbo
chuangbo / README.md
Last active June 19, 2023 04:48
Python dynamic DNSPod DNS Script

替换上你的 API Token,域名ID,记录ID等参数,就可以运行了。 会在后台一直运行,每隔30秒检查一遍IP,如果修改了就更新IP。

获取 API Token 的方式

获得 domain_id 可以用 curl

curl -k https://dnsapi.cn/Domain.List -d "login_token=TOKEN"`
@flackou
flackou / mysql2_wait_timeout.rb
Created December 23, 2011 13:04
Testing mysql2 wait_timeout param
require 'rubygems'
gem 'mysql2'
gem 'activerecord', '3.1.1'
require 'active_record'
# http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html#sysvar_wait_timeout
MYSQL_WAIT_TIMEOUT_MAX = 2147483
# Testing the remote db connection after a 60s sleep
def test_connection(extra_conf = {})
@clippit
clippit / gist:2118324
Created March 19, 2012 16:32
Play a 24 Game with four 0s
#include <stdio.h>
int main() {
printf("%d\n", '0'/(('0'+'0')/'0'));
printf("%d\n", '0'>>'0'/'0'+0);
printf("%d\n", -~-~-~-~-~-~0-~-~-~-~-~-~0-~-~-~-~-~-~0-~-~-~-~-~-~0);
return 0;
}
@nightire
nightire / Changes in Rails 4_1.md
Last active May 11, 2022 04:50
拥抱 Rails 4 —— 详述 Rails 4 的新变化

Routes

小心地使用 Match(Rails 3 已实现)

Rails 3 提供了 match 方法供我们自定义 routes,然而我们要小心使用它以避免“跨站脚本攻击”(XSS Attack)。比如像这样的 routes:

注:(r3 代表 Rails 3,r4 代表 Rails 4)

# routes.rb
@glts
glts / README
Last active February 23, 2024 16:54
Benchmark for Vim regexp engine performance
Regular expressions and data from
http://lh3lh3.users.sourceforge.net/reb.shtml
Regular expressions benchmarked:
URI ([a-zA-Z][a-zA-Z0-9]*)://([^ /]+)(/[^ ]*)?
Email ([^ @]+)@([^ @]+)
Date ([0-9][0-9]?)/([0-9][0-9]?)/([0-9][0-9]([0-9][0-9])?)
URI|Email ([a-zA-Z][a-zA-Z0-9]*)://([^ /]+)(/[^ ]*)?|([^ @]+)@([^ @]+)
Word .*SCSI-
@staltz
staltz / introrx.md
Last active June 26, 2024 10:24
The introduction to Reactive Programming you've been missing
@eyeplum
eyeplum / lumiere.rs
Last active October 19, 2015 09:21
A talk about WWDC15 at Liulishuo House-warming Party
// Trying to build a Rust version here
extern crate rustc_serialize;
use std::io;
use std::env;
use std::path::Path;
use std::fs::File;
use std::io::Read;
use std::vec;
@enricofoltran
enricofoltran / main.go
Last active June 26, 2024 12:16
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
@JoeyBurzynski
JoeyBurzynski / 55-bytes-of-css.md
Last active June 2, 2024 11:24
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}
@jinjier
jinjier / 250.csv
Last active June 24, 2024 06:00
JavDB Top 250 movies code list. [Updated at 2024/02]
1 LAFBD-41
2 SSNI-497
3 ABP-984
4 IPX-580
5 IPX-811
6 IPX-177
7 STARS-804
8 SMBD-115
9 ABP-968
10 ABF-017