Skip to content

Instantly share code, notes, and snippets.

@arsane
arsane / remove_duplicates.py
Created August 25, 2014 02:36
remove files with same content under same folder.
import os, sys
import hashlib
def file_digest(f):
m = hashlib.md5()
m.update(file(f).read())
return m.hexdigest()
def remove_duplicates(dir):
# size, list of files.
// ==UserScript==
// @name ganster
// @namespace [email protected]
// @include http://www.sexgangsters.com/*
// @version 1
// @grant none
// ==/UserScript==
var api_call = function(api_method, api_args, api_callback) {
return function() {
@arsane
arsane / monitorcard.py
Created February 17, 2015 10:07
Detect dynamic smart card insertion and removal.
from smartcard.System import readers
from smartcard.CardType import AnyCardType
from smartcard.CardRequest import CardRequest
from smartcard.CardConnection import CardConnection
from smartcard.util import toHexString, toBytes
from smartcard.CardMonitoring import CardMonitor, CardObserver
from smartcard.util import *
from time import sleep
def check_reader():
@arsane
arsane / swift.md
Created March 1, 2015 09:56
openstack swift notes.

Requirements

  • Ubuntu 12.04
  • OpenStack havana release
  • python-swiftclient Swifit CLI
  • cURL
  • Swift tools such as Swift-Recon, Swift-Informant, and Swift-Dispersion
  • A StatsD server. https://github.com/etsy/statsd
@arsane
arsane / solution1.cpp
Created March 19, 2015 15:25
mastermind
string colors("BGR"), comb(4, '.'), l(comb), guess;
typedef map<int,int> M;
struct Color {
Color( M& cm, M& gm, int& color )
: cm_(cm), gm_(gm), color_(color=0) { }
void operator()( char c )
{ color_ += min( cm_[c], gm_[c] ); }
M &cm_, &gm_;
@arsane
arsane / mastermind.cpp
Created March 22, 2015 06:08
mastermind.cpp in c++11
#include <algorithm>
#include <iostream>
#include <map>
using namespace std;
/**
* @brief repeat helper.
*/
template <typename F>
@arsane
arsane / Excel.md
Last active August 29, 2015 14:17
Free Excel tutorials

Excel resource list

  • ImporveYourExcel is a clean looking site with over 60 introductory video tutorials for Excel.
  • Excel Easy a simple excel reference worth checking out. It contains all the basics one needs to get function. It does not have any videos but does have explicit instructions with pictures and there no adverisements whatsoever.
  • Excel Exercises Basic exercises.
  • Excel youtube playlist
  • Excel 学习 a chinese excel youtube playlist.
@arsane
arsane / cabal.md
Created March 31, 2015 11:26
learning cabal usage.