Skip to content

Instantly share code, notes, and snippets.

View offlinehacker's full-sized avatar
🤓
deploying awesomeness

Jaka Hudoklin offlinehacker

🤓
deploying awesomeness
View GitHub Profile
/* This file defines the builds that constitute the Nixpkgs.
Everything defined here ends up in the Nixpkgs channel. Individual
jobs can be tested by running:
$ nix-build pkgs/top-level/release.nix -A <jobname>.<system>
e.g.
$ nix-build pkgs/top-level/release.nix -A coreutils.x86_64-linux
*/
class overridable_property(property):
"""
Property where you can override return value by setting _name
>>> class test(object):
... @overridable_property
... def test(self):
... return "abcd"
...
>>> a = test()
@offlinehacker
offlinehacker / divide.py
Last active March 19, 2022 19:04
Devides list in all posible sublists, without repetitions
from itertools import combinations
def divide(l, p={}):
for v in (j for i in xrange(1, len(l) + 1) for j in combinations(l, i)):
r = tuple(set(l) - set(v))
for s in devide(r):
t = (v,) + (s if s else tuple())
if frozenset(t) in p: continue
else: yield t; p[frozenset(t)] = True
@offlinehacker
offlinehacker / mergewithbase.py
Last active January 8, 2022 18:21
Merges result of function or attribute from child class with result of function or attribute from the base class.
class merge_with_base(object):
"""
Merges result of function or attribute from child class with result of
function or attribute from the base class.
:param type: Use this base class instead of first base class found and
not with mixins
.. note::
@offlinehacker
offlinehacker / google_stt.py
Created June 14, 2013 07:35
Quick and dirty python implementation of client for google speech to text service using google speech stream API. It requires requests, pyaudio and pyflac to be installed. Don't forget to set your API key. Current limit seems to be around 5 minutes.
#!/usr/bin/python
import flac.encoder as encoder
import pyaudio
import sys
import requests
import random
from threading import Thread
from Queue import Queue, Empty
@offlinehacker
offlinehacker / aes_brute.sh
Created March 29, 2013 23:42
Simple shell AES brute forcer (especially usefull for bitcoin private keys)
#!/bin/bash
echo "Using wordlist $1"
echo "Using key $2"
cat $1 | while read LINE ; do
#echo "pass: $LINE"
key=$2
p1=${key:0:64}
p2=${key:64}
echo "$p1"$'\n'"$p2" > process
ret=$(openssl enc -d -aes-256-cbc -in process -a -k $LINE 2>/dev/null)
@offlinehacker
offlinehacker / git-annex-ubuntu.md
Created March 26, 2013 15:14
Ubuntu git-annex install

================ GIT Annex ubuntu

  • sudo apt-get install cabal-install
  • sudo cabal update
  • sudo apt-get install libgsasl7-dev
  • sudo apt-get install c2hs
@offlinehacker
offlinehacker / file-force.py
Created March 26, 2013 10:55
Brute forcer for file names, with folder support. Could be used for some ASP web apps.
# -*- coding: utf-8 -*-
import sys
import time
import string
import socket
import requests
import urllib3
from urllib3 import HTTPConnectionPool
LD_LIBRARY_PATH=../lib64/ ./glc-capture --start -v 3 --disable-audio --uncompressed=1M -z none -o /dev/stdout -l /dev/stderr etracer | LD_LIBRARY_PATH=../lib64/ ./glc-play /dev/stdin -t -v 3 -y 1 --uncompressed=1M -o /dev/stdout | ffmpeg -i /dev/stdin -f yuv4mpegpipe -pix_fmt yuv420p -vcodec libx264 -vprofile baseline -preset ultrafast -tune zerolatency -x264opts "intra-refresh:vbv-maxrate=5000:vbv-bufsize=200:slice-max-size=1500:sliced-threads" -threads auto -f yuv4mpegpipe -o /dev/stdout | ../../scripts/video/example
gcc -g -std=gnu99 -Wall -I/usr/include -L/usr/lib -L/usr/lib/x86_64-linux-gnu/ test.c aveasy.c -lglut -lGL -lGLU -lGLEW -lglfw `pkg-config --cflags --libs libavcodec libavformat libavdevice libswscale` -o example
import os
import sys
import Image, ImageSequence
import numpy as np
from images2gif import writeGif
filename = sys.argv[1]
im = Image.open(filename)
original_duration = im.info['duration']