Skip to content

Instantly share code, notes, and snippets.

View sorz's full-sized avatar
😱
AAHHH

Shell Chen sorz

😱
AAHHH
View GitHub Profile
@sorz
sorz / OkHttpStack.java
Created January 2, 2016 15:28 — forked from bryanstern/OkHttpStack.java
An OkHttp backed HttpStack for Volley
/**
* The MIT License (MIT)
*
* Copyright (c) 2015 Circle Internet Financial
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
#!/usr/bin/bash
DIR=/path/to/www/public
DATA=/path/to/pms5003.rrd
TIME=$1
time=$(date '+%H\:%M\:%S')
rrdtool graph $DIR/pm-$TIME.svg \
--imgformat SVG \
@sorz
sorz / twitter.mute.js
Last active November 7, 2015 08:29 — forked from fdb713/twitter.mute.js
mute tweets containing specific keyword.
// origin: @ayanamist
// ==UserScript==
// @name Twitter Keyword Filter
// @namespace Twitter-Timeline-URL-Expand
// @description Replace t.co href of A tag with real url.
// @match https://twitter.com/
// @version 1.1
// ==/UserScript==
(function (window) {
var document = window.document;
@sorz
sorz / paste.conf
Last active July 8, 2018 08:11
Source code of paste.sorz.org
server {
server_name example.com;
charset utf-8;
location ~ "/t/([^/]+)(/[^/]+)?$" {
alias /srv/http/paste/data/$1;
gunzip on;
gzip_static always;
default_type text/plain;
@sorz
sorz / queble.user.js
Created May 3, 2015 12:24
Apply correct Chinese name on AcFun.
// ==UserScript==
// @name 缺B乐
// @namespace org.sorz.lab.queble
// @include http://www.acfun.tv/*
// @version 1
// @grant none
// ==/UserScript==
String.prototype.correct = function () {
return this.toString()
@sorz
sorz / ddns-hosts.json
Last active January 3, 2017 04:39
DDNS HTTP API
{
"host": "password",
"sorz": "hWUVw79k"
}
@sorz
sorz / rs16.py
Created March 13, 2015 10:10
Reed-Solomon correction in GF(2^16), seems work.
# Modified from
# http://en.wikiversity.org/wiki/Reed–Solomon_codes_for_coders
gf_exp = [0] * 65536 * 2 # Create list of 65536 elements. In Python 2.6+, consider using bytearray
gf_log = [0] * 65536
gf_exp[0] = 1
x = 1
for i in range(1, 65535):
x <<= 1
if x & 0x10000:
@sorz
sorz / DHT22.cpp
Last active July 14, 2021 16:46
All files related to a toy air temp/humi/dust mointor based on DHT22, GP2Y1010AU0F, Arduino and Cubieboard (or Raspberry Pi).
/*
DHT22.cpp - Library for DHT22/DHT11 relative humidity & temperature sensor.
Created by Sorz. 2014-07-18.
*/
#include "Arduino.h"
#include "DHT22.h"
TempHumiSensor::TempHumiSensor(int pin)
{
pinMode(pin, INPUT_PULLUP);
# fail2ban filter configuration for Shadowsocks (python).
[Definition]
failregex = can not parse header when handling connection from <HOST>:\d{1,5}$
ignoreregex =
#!/bin/sh
PPP_IFACE="$1"
PPP_TTY="$2"
PPP_SPEED="$3"
PPP_LOCAL="$4"
PPP_REMOTE="$5"
PPP_IPPARAM="$6"
if [ "$PPP_IFACE" = "ppp0" ]