Skip to content

Instantly share code, notes, and snippets.

@cs278
cs278 / dovecot-maildir-compress.sh
Created December 17, 2011 15:52
Compresses email in maildir format
#!/bin/sh
# Find the mails you want to compress in a single maildir.
#
# Skip files that don't have ,S=<size> in the filename.
#
# Compress the mails to tmp/
#
# Update the compressed files' mtimes to be the same as they were in the original files (e.g. touch command)
#
@bartku
bartku / gist:2419852
Created April 19, 2012 08:59
world of tanks api
Searching players:
http://worldoftanks.eu/community/accounts/api/%API_VER%/?source_token=%TOKEN%&search=%NAME%&offset=0&limit=1
Showing player's stats:
http://worldoftanks.eu/community/accounts/%PLAYER_ID%/api/%API_VER%/?source_token=%TOKEN%
Showing player's stats from past:
http://dava2.worldoftanks.com/userstats/2/stats/slice/?platform=android&server=eu&account_id=%PLAYER_ID%&hours_ago=24&hours_ago=168&hours_ago=336
@kolo
kolo / gist:2724734
Created May 18, 2012 11:14 — forked from bartku/gist:2419852
world of tanks api
http://worldoftanks.eu/community/accounts/api/%API_VER%/?source_token=%TOKEN%&search=%NAME%&offset=0&limit=1
http://worldoftanks.eu/community/accounts/%PLAYER_ID%/api/%API_VER%/?source_token=%TOKEN%
http://worldoftanks.eu/community/clans/api/%API_VER%/?source_token=%TOKEN%&search=%CLAN_NAME%&offset=0&limit=1
http://worldoftanks.eu/community/clans/%CLAN_ID%/api/%API_VER%/?source_token=%TOKEN%
http://worldoftanks.eu/personal/api/%API_VER%/?source_token=%TOKEN%
login req: getlogin: https://worldoftanks.eu/auth/create/api/1.0/?source_token=%TOKEN%
gettoken: https://worldoftanks.eu/utils/csrf/api/1.0/?source_token=%TOKEN%
api versions: 1.0, 1.1, 1.2, 1.3
@dariocravero
dariocravero / README.md
Created October 20, 2012 05:25
Save files in Meteor

Create a Meteor app and put the client_/server_ files in a client/server directories. Also, create a public dir to save the uploaded files.

@return1
return1 / trim_enabler.txt
Last active May 26, 2024 11:01
TRIM Enabler for OS X Yosemite 10.10.3
#
# UPDATE for 10.10.4+: please consider this patch obsolete, as apple provides a tool called "trimforce" to enable trim support for 3rd party SSDs
# just run "sudo trimforce enable" to activate the trim support from now on!
#
# Original version by Grant Parnell is offline (http://digitaldj.net/2011/07/21/trim-enabler-for-lion/)
# Update July 2014: no longer offline, see https://digitaldj.net/blog/2011/11/17/trim-enabler-for-os-x-lion-mountain-lion-mavericks/
#
# Looks for "Apple" string in HD kext, changes it to a wildcard match for anything
#
# Alternative to http://www.groths.org/trim-enabler-3-0-released/
@bartku
bartku / gist:4271798
Last active January 31, 2024 01:05
Unofficial description of unofficial World of Tanks API

World of Tanks unofficial API

World of Tanks, popular MMO game about tanks from time around WWII, has some nice mobile application called Wot Assistant (available also at AppStore and MS Marketplace). With simple packet sniffing you can guess how it retrieves players' statistics.

Surprisingly, mobile application uses quite simple API over HTTP which serves data in JSON, which is great help for people interested in creating own applications handling statistical data in game.

At this moment here is list of API features that has been discovered:

  • searching players by names
  • searching clans by names
@reifman
reifman / default.vcl
Last active September 9, 2021 08:15
Example Varnish VCL Configuration e.g. /etc/varnish/default.vcl
# Default backend definition. Set this to point to your content server.
backend default {
.host = "127.0.0.1";
.port = "8080";
.connect_timeout = 60s;
.first_byte_timeout = 60s;
.between_bytes_timeout = 60s;
.max_connections = 800;
}
@willurd
willurd / web-servers.md
Last active June 21, 2024 11:28
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@tinynumbers
tinynumbers / active_admin.rb
Last active April 21, 2024 08:57
ActiveAdmin controller extension to persist resource index filters between requests.
# this stuff goes in config/initializers/active_admin.rb
ActiveAdmin.setup do |config|
# ...
# put these lines in the "Controller Filters" section of the ActiveAdmin.setup block
# These two are defined in ActiveAdmin::FilterSaver::Controller, which is loaded below.
config.before_filter :restore_search_filters
@victorquinn
victorquinn / promise_while_loop.js
Last active March 30, 2023 04:29
Promise "loop" using the Bluebird library
var Promise = require('bluebird');
var promiseWhile = function(condition, action) {
var resolver = Promise.defer();
var loop = function() {
if (!condition()) return resolver.resolve();
return Promise.cast(action())
.then(loop)
.catch(resolver.reject);