Skip to content

Instantly share code, notes, and snippets.

View larvata's full-sized avatar

Larvata larvata

View GitHub Profile
@larvata
larvata / demo.coffee
Last active August 29, 2015 14:19
MeruTask 同步顺序执行异步任务
request = require 'request'
client= require('redis').createClient()
meru=require './libs/meruTask'
###
GET lastPostId FROM api (getLastPostIdFromAPI)
GET nextPostId FROM redis DEFAULTS 1 (getNextPostIdFromRedis)
LOOP:
IF nextPostId<=lastPostId (checkNewPostsAvailable)
@larvata
larvata / tampermonkey-twitter-full-image.js
Last active March 15, 2018 07:27
twitter full size image
// ==UserScript==
// @name twitter full size image
// @namespace https://github.com/larvata
// @version 0.3
// @description always get the hi-res image from twitter
// @author Larvata
// @match https://pbs.twimg.com/*
// @grant none
// @license MIT
// ==/UserScript==
@larvata
larvata / tampermonkey-google-plus-full-image.js
Last active January 31, 2017 09:34
google plus full size image
// ==UserScript==
// @name google plus full size image
// @namespace http://larvata.me/
// @version 0.1
// @description enter something useful
// @author Larvata
// @match *://*.googleusercontent.com/*
// @grant none
// ==/UserScript==
@larvata
larvata / shadowsocks-quota
Last active October 14, 2023 16:06
shadowsocks bandwidth limit and data quota each port
# draft
# view current data quota
sudo iptables -nvL -t filter --line-numbers
# init
sudo iptables -I OUTPUT -p tcp --sport <target-port> -m quota --quota <quota-bytes> -j ACCEPT
sudo iptables -I OUTPUT -p tcp --sport <target-port> -j DROP
# reset quota
@larvata
larvata / BuffWalker.cs
Created January 13, 2015 02:36
A binary reader
public class BuffWalker
{
public byte[] Buffer;
private uint _positon;
public EndiannessEnum Endianness { get; set; }
public long RestBytesCount
{
get { return this.Buffer.LongLength - _positon; }
}
@larvata
larvata / ConfigurationWrapper.cs
Created December 9, 2014 08:50
Common ConfigurationManager for app.config and web.config
using System.Collections.Specialized;
using System.Configuration;
using System.Reflection;
using System.Web.Configuration;
namespace TinyMess.Common
{
internal static class ConfigurationManagerWrapper
{
private static bool IsAspDotNet { get; set; }
@larvata
larvata / tampermonkey-oricon-large-cover.js
Last active May 25, 2016 20:18
oricon Large Cover download
// ==UserScript==
// @name oricon Large Cover
// @namespace http://use.i.E.your.homepage/
// @version 0.1
// @description enter something useful
// @match http://www.oricon.co.jp/rank/*
// @copyright 2012+, You
// ==/UserScript==
$.each($(".item_img>div:first-child>a"),function(i,obj){
@larvata
larvata / bit-dice.js
Last active May 25, 2016 20:18
auto script for btc-dice
// ==UserScript==
// @name BTC-DICE
// @namespace http://use.i.E.your.homepage/
// @version 0.1
// @description enter something useful
// @match http://www.btc-dice.com/*
// @copyright 2012+, You
// ==/UserScript==
///////// CONST /////////
@larvata
larvata / JUST-DICE-2.js
Last active June 24, 2017 03:29
auto script for just-dice with new feature
// ==UserScript==
// @name JUST-DICE
// @namespace http://use.i.E.your.homepage/
// @version 0.1
// @description enter something useful
// @match https://just-dice.com/*
// @copyright 2012+, You
// ==/UserScript==
///////// CONST /////////
@larvata
larvata / JUST-DICE.js
Last active May 25, 2016 20:20
auto script for just-dice
// ==UserScript==
// @name JUST-DICE
// @namespace http://use.i.E.your.homepage/
// @version 0.1
// @description enter something useful
// @match https://just-dice.com/*
// @copyright 2012+, You
// ==/UserScript==
///////// CONST /////////