Skip to content

Instantly share code, notes, and snippets.

View Psycojoker's full-sized avatar
💭
I'm really busy right now, I can take weeks to answer.

Bram Psycojoker

💭
I'm really busy right now, I can take weeks to answer.
View GitHub Profile
@Psycojoker
Psycojoker / catacombs_init.sh
Created August 21, 2012 21:21
Gitolite installation script
#!/bin/bash
if [ "$(whoami)" != "root" ]
then
echo "run script as root"
fi
if [ ! "$1" ]
then
echo "give your username as first argument"
@Psycojoker
Psycojoker / Instructions
Created August 22, 2012 15:04
Steam catalog total price
Run dl.sh then one of the two python script.
You need at least BeautifulSoup and pprocess if you want to test the multiprocess script.
@Psycojoker
Psycojoker / parse.py
Created December 9, 2012 21:43
alct apprend le yaml stp
import json
from urllib2 import urlopen
all_rows = []
for brole in filter(None, map(lambda x: x.strip(), urlopen("https://nurpa.be/files/rp-SABAM.html").read().split("---"))):
#for brole in filter(None, map(lambda x: x.strip(), open("a").read().split("---"))):
row = {}
if brole[0] == "#":
year = int(brole.replace("#", "").strip())
@Psycojoker
Psycojoker / gist:5379345
Created April 13, 2013 17:43
To solve this (french): http://www.dailymotion.com/lemondefr#video=xyy7h2 Lazy (not in the programming sens) approach using random, was too lazy to write a backtracking.
from random import choice
def generate_grille():
return [
[-1, -1, -1],
[-1, -1, -1],
[-1, -1, -1],
]
def print_grille(grille):
@Psycojoker
Psycojoker / a Instructions.sh
Created May 21, 2013 22:42
Some attempt to extract votes records out of la_chambre.be pdfs. NOT YET PERFECT!
mkdir pdfs
cd pdfs
# first download everything
wget $(lynx -dump "http://www.lachambre.be/kvvcr/showpage.cfm?section=/cricra&language=fr&cfm=dcricra.cfm?type=plen&cricra=cri&count=all" | grep "[^x].pdf$" | purls | puniq)
# then transform everything
for i in *; do pdftotext $i; done
# then run the script
@Psycojoker
Psycojoker / data.json
Created October 30, 2013 01:26
To reproduce a bug on ijson.
[{"dossierid": "4ddebaac865c0c17de0004c2", "Abstain": {"total": "73", "groups": [{"votes": [{"id": "4de182cf0fb8127435bdbb2f", "orig": "Alvaro"}, {"id": "4de182c70fb8127435bdbb22", "orig": "Attwooll"}, {"id": "4de183530fb8127435bdbbea", "orig": "Beaupuy"}, {"id": "4de183490fb8127435bdbbdb", "orig": "Busk"}, {"id": "4de183d20fb8127435bdbcaa", "orig": "Cocilovo"}, {"id": "4de183d50fb8127435bdbcaf", "orig": "Costa Paolo"}, {"id": "4de1842a0fb8127435bdbd2e", "orig": "Davies"}, {"id": "4de184300fb8127435bdbd36", "orig": "De Sarnez"}, {"id": "4de184510fb8127435bdbd64", "orig": "Drčar Murko"}, {"id": "4de1843a0fb8127435bdbd46", "orig": "Duff"}, {"id": "4de184560fb8127435bdbd6a", "orig": "Duquesne"}, {"id": "4de184b30fb8127435bdbdeb", "orig": "Fourtou"}, {"id": "4de185110fb8127435bdbe78", "orig": "Gibault"}, {"id": "4de1855b0fb8127435bdbedf", "orig": "Hall"}, {"id": "4de1855f0fb8127435bdbee5", "orig": "Harkin"}, {"id": "4de185650fb8127435bdbeed", "orig": "Hennis-Plasschaert"}, {"id": "4de185590fb8127435bdbedd", "orig
@Psycojoker
Psycojoker / anti_glande_imgur.js
Created November 24, 2013 15:39
Remove right panel of imgur to prevent me from spending hours on this website.
// ==UserScript==
// @name imgur anti glande
// @namespace *imgur.com*
// @description pour arrêter de perdre ma vie sur imgur
// @include *imgur.com*
// @match http://*.reddit.com/*
// @version 1
// @grant none
// ==/UserScript==
@Psycojoker
Psycojoker / gist:8213444
Last active June 26, 2016 12:27
How to install git-annex using cabal on ubuntu LTS 12.4
# make sure that this line is present in /etc/apt/sources.list: deb http://be.archive.ubuntu.com/ubuntu/ precise universe
sudo apt-get update
sudo apt-get install -y cabal-install libgnutls-dev liblz-dev libxml-sax-perl pkg-config libidn11-dev libxml2-dev libgsasl7-dev git
# if not present in your ~/.{z,ba}shrc
export PATH="$HOME/.cabal/bin:"$PATH
# if it's NOT present, git-annex won't be on your $PATH so you won't be able to use it
# if you want to use another directory for the bins, append "--bindir=$HOME/bin" to the cabal commands
import sys
from redbaron import RedBaron
red = RedBaron(open("../../django/hackeragenda/events/management/commands/fetch_events.py", "r").read())
base_call = RedBaron("a()").call
sys.path.append("../../django/hackeragenda/events")
from colors import COLORS
In [3]: from redbaron import RedBaron
In [4]: from colors import COLORS # this file https://github.com/Psycojoker/hackeragenda/blob/76b032ad6b3795eba1fd6224a83edf52833d1484/events/colors.py
In [5]: red = RedBaron(open("../../django/hackeragenda/events/management/commands/fetch_events.py", "r").read())
# here I'm looking for the best way to get what I want
# I've cut a bug part of the output
In [6]: red("call")
Out[6]: