Skip to content

Instantly share code, notes, and snippets.

@cwvh
cwvh / countingbloom.py
Created December 9, 2011 23:04
Simple counting bloom filter in Python.
def hashfn(item):
h = hash(item)
return (1 << (h%64)) | (1 << (h/64%64))
def mask(val):
return bin(hashfn(val))[2:]
class CountingBloom(object):
def __init__(self):
self.items = [0] * 64
@CristinaSolana
CristinaSolana / gist:1885435
Created February 22, 2012 14:56
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@richard-flosi
richard-flosi / bottle-cors.py
Created September 26, 2012 16:55
Bottle with Cross-origin resource sharing (CORS)
"""
Example of setting up CORS with Bottle.py.
"""
from bottle import Bottle, request, response, run
app = Bottle()
@app.hook('after_request')
def enable_cors():
"""
vif_func<-function(in_frame,thresh=10,trace=T,wts=NULL,...){
library(fmsb)
if(any(!'data.frame' %in% class(in_frame))) in_frame<-data.frame(in_frame)
if(is.null(wts))
wts <- rep(1, ncol(in_frame))
if(!is.null(wts))
if(length(wts)!=ncol(in_frame)) stop('length of weights must equal number of variables')
@mmdemirbas
mmdemirbas / set-ntfs-ro.ps1
Created March 23, 2013 20:54
PowerShell script to set or clear NTFS read-only flag of a volume by volume label
#########################################################################
# #
# Script to set or clear read-only flag of an NTFS volume. #
# #
# Usage: .\set-ntfs-ro.ps1 set "MY DISK LABEL" #
# .\set-ntfs-ro.ps1 clear "MY DISK LABEL" #
# #
# Author: Muhammed Demirbas, mmdemirbas at gmail dot com #
# Date : 2013-03-23 #
# #
@gterzian
gterzian / gist:6400170
Last active May 15, 2019 16:57
Ruby's method_missing in Python...
import unittest
from functools import partial
class MethodMissing:
def method_missing(self, name, *args, **kwargs):
'''please implement'''
raise NotImplementedError('please implement a "method_missing" method')
def __getattr__(self, name):
return partial(self.method_missing, name)
@DarthJahus
DarthJahus / keybase.md
Last active January 8, 2018 01:08
keybase.md

Keybase proof

I hereby claim:

  • I am darthjahus on github.
  • I am jahus (https://keybase.io/jahus) on keybase.
  • I have a public key ASDkGAQew4GIsMVYWnECTpTgsG_5VRFyL489t8mZ1TCdIwo

To claim this, I am signing this object:

// Jahus, 2016-07-11 01:42 GMT+1
// Fonction qui renvoie un dictionnaire composé des paramètres et de leurs valeurs
public Dictionary<string, string> GetURIParams(string strURI)
{
Regex rx = new Regex("[?|&]([^=]+)=([^&]+)"); // Cherche tous les paramètres dans une URI
MatchCollection rxm = rx.Matches(strURI); // Effectue la recherche dans l'URI "MyInput"
Dictionary<string, string> Params = new Dictionary<string, string>(); // Crée un dictionnaire des paramètres
@neuni
neuni / openvpn_on_google_cloud.md
Created February 28, 2017 13:34
Create a openVPN server on Google Cloud Platform to connect to your Google Cloud network using openVPN and/or to route your internet traffic through the VPN (Road Warrior Scenario)

Install openVPN server on Google Cloud using Pritunl

Purpose:

Create a openVPN server on Google Cloud Platform to connect to your Google Cloud network using openVPN and/or to route your internet traffic through the VPN (Road Warrior Scenario)

Create instance

  • Create new instance in default network
  • Chosse Ubuntu 16.04 LTS

Installation de HomeBrew pour 11.2/11.3 + JKSM

Préparatifs

  1. Télécharger ce ZIP : http://smealum.github.io/ninjhax2/starter.zip
  2. Prendre le fichier .m4a de Soundhax (il dépend de la région de ta DS et du modèle) : http://soundhax.com/
  3. Prendre le "payload" ici (dépend du modèle et du firmware) : https://smealum.github.io/3ds/#otherapp
  4. Prendre JKSM : https://github.com/J-D-K/JKSM/releases/download/6-30-2016/JKSM.6-30-2016.zip

Installation

a. Dans le starter.zip, il y a un dossier starter ; c'est le contenu de ce dossier qu'il faut copier vers la racine de la Carte SD ;