Skip to content

Instantly share code, notes, and snippets.

View ibizaman's full-sized avatar

Pierre Penninckx ibizaman

View GitHub Profile
@ibizaman
ibizaman / merge_folders.sh
Last active June 4, 2016 07:18
Merge folders
# Assumptions:
# You want to merge the files from at least two folders.
# There is one directory you consider as the destination folder, in which you one to merge all other folder.
# Compute and save md5 hashes
find $thruth_folder -type f -print0 | xargs -0 -L 1 md5sum | tee hashes.1
find $folder1 -type f -print0 | xargs -0 -L 1 md5sum | tee hashes.2
# ...
# Do that for all the folders you want. Important, make sure all $folders are different,
# that will ensure all files have a different prefix on which we can match later.
@ibizaman
ibizaman / t411-wrap
Created February 25, 2016 17:47
Wrapper around t411 to make workflow more enjoyable
#!/bin/bash
# pip install percol
# pip install prompter
movie=$1
ok=false
while [ $ok = false ]; do
torrentId=$(t411 -l 40 search -c filmvideo/film "$movie" size | percol | awk '{ print $1}')
@ibizaman
ibizaman / fail.log
Last active February 16, 2016 05:59
ib-tws install fail log
==> Making package: ib-tws 954.2s-2 (Tue Feb 16 04:30:50 UTC 2016)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
-> Found LICENSE
-> Found ib-tws
-> Found ib-tws.desktop
-> Found ib-gw
-> Found ib-gw.desktop
-> Downloading tws-latest-standalone-linux-x64.sh...
#!/bin/bash
# Thanks to this post:
# http://blog.ikato.com/post/15675823000/how-to-install-consolas-font-on-mac-os-x
brew install cabextract
cd ~/Downloads
mkdir consolas
cd consolas
curl -O http://download.microsoft.com/download/f/5/a/f5a3df76-d856-4a61-a6bd-722f52a5be26/PowerPointViewer.exe
cabextract PowerPointViewer.exe
#!/usr/bin/env python
"""
Taken from http://www.stavros.io/posts/python-fuse-filesystem/
"""
from __future__ import with_statement
import os
import sys
@ibizaman
ibizaman / consumer.hs
Last active August 29, 2015 14:27
Simple recursive consumer for kafka
import Haskakafka
import qualified Data.ByteString.Char8 as C8
kafkaConfig = []
topicConfig = []
host = "localhost:9092"
topic = "ttp"
partition = 0
timeoutMs = 1000
@ibizaman
ibizaman / gist:5a141c887e7e8c5e176a
Created July 15, 2015 10:13
Remove find functionality from RedBaron's getattr
def __getattr__(self, key):
- return self.find(key)
+ for i in self.data:
+ if key in i._identifiers:
+ return i
def __getattr__(self, key):
- if key.endswith("_") and key[:-1] in self._all_my_keys():
- return getattr(self, key[:-1])
-
@ibizaman
ibizaman / Diff
Last active August 29, 2015 14:24
Enhancement of redbaron's _attribute_match_query
extract if case outside of a loop
diff --git a/redbaron/redbaron.py b/redbaron/redbaron.py
index 4d37dcb..5a7d3fd 100644
--- a/redbaron/redbaron.py
+++ b/redbaron/redbaron.py
@@ -788,32 +788,22 @@ class Node(GenericNodesUtils):
Take a list/tuple of attributes that can match and a query, return True
if any of the attributes match the query.
"""
@ibizaman
ibizaman / Generate graph
Last active August 29, 2015 14:24
cProfile output
gprof2dot -f pstats $profile_file | dot -Tpng -o $profile_graph
gnome-open $profile_graph
@ibizaman
ibizaman / Failing log - remote .json file
Created March 1, 2015 21:29
Logs for self-hosted versionning with .json file over scp
INFO interface: output: Box 'archlinux-x86_64' could not be found. Attempting to find and install...
INFO interface: output: ==> build: Box 'archlinux-x86_64' could not be found. Attempting to find and install...
==> build: Box 'archlinux-x86_64' could not be found. Attempting to find and install...
INFO interface: detail: Box Provider: virtualbox
INFO interface: detail: build: Box Provider: virtualbox
build: Box Provider: virtualbox
INFO interface: detail: Box Version: >= 0
INFO interface: detail: build: Box Version: >= 0
build: Box Version: >= 0
INFO runner: Preparing hooks for middleware sequence...