Skip to content

Instantly share code, notes, and snippets.

View romanbarczynski's full-sized avatar

Roman Barczyński romanbarczynski

View GitHub Profile
@romanbarczynski
romanbarczynski / wp_crypt.py
Last active November 18, 2018 20:39
Create WordPress passwords from python code
# Credits go to:
# https://www.facebook.com/permalink.php?id=120707754619074&story_fbid=389700354386478
# Fixed spacing (posting python on facebook is gr8 idea guys)
# Added generating passwords.
from hashlib import md5
import random
itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
@romanbarczynski
romanbarczynski / milkman_words.py
Created April 24, 2015 19:36
Milkman words generator for varchar
words = [
'Alfa',
'Bravo',
'Charlie',
'Delta',
'Echo',
'Foxtrot',
'Golf',
'Hotel',
'India',
@romanbarczynski
romanbarczynski / bb-hg-merge-ui.js
Created July 1, 2013 08:54
Greasemonkey script for hg commands on pull requests page...
// ==UserScript==
// @name Bitbucket show merge commandline
// @namespace http://www.romke.net/static/grease/bb-pull-merge
// @description show merge commandline
// @include https://bitbucket.org/*/pull-request/*
// @grant none
// @version 1
// ==/UserScript==
if (! document.getElementsByClassName("conflicts-detected")[0].classList.contains("conflicts") &&
@romanbarczynski
romanbarczynski / colors.pl
Created June 28, 2013 22:23
Generate finite number of colors (hex values ready for rrdtool, without leading '#') that are distinguishable on stack graphs. Usage: my @Colors = gen_colors(10);
sub gen_colors {
my $total = shift;
my @colors = ();
# round up to even number of colors:
$total = floor($total/2+1)*2;
# but divide by 1 more so first and last is different:
my $step = 360 / ($total+1);
@romanbarczynski
romanbarczynski / pyexiv2.sh
Created October 22, 2012 10:26
pyexiv2 ubuntu virtualenv install
. virtualenv/bin/activate
sudo apt-get install scons libexiv2-dev libboost-dev libboost-python-dev
mkdir build
cd build
wget http://launchpad.net/pyexiv2/0.3.x/0.3.2/+download/pyexiv2-0.3.2.tar.bz2 -O-| tar -xpvj
cd pyexiv2*
scons
scons install
@romanbarczynski
romanbarczynski / volume.rb
Created May 18, 2012 18:17 — forked from jaspervdj/volume.rb
Set pulseaudio volume from the command line
#!/usr/bin/ruby
# Pulseaudio volume control
class Pulse
attr_reader :volumes, :mutes
# Constructor
def initialize
dump = `pacmd dump`.lines
@volumes = {}
def get_form_dict(form):
data = {}
for name, field in form.fields.items():
bf = BoundField(form, field, name)
data[form.add_prefix(name)] = unicode(bf.value() or '')
return data
{
***************************************************
* A binary compatible SHA1 implementation *
* written by Dave Barton ([email protected]) *
***************************************************
* 160bit hash size *
***************************************************
}
unit SHA1;
# vim: set ts=2 sw=2 et :
#
# load_data loads varibles from external yaml file.
#
# EXAMPLE 1:
# data.yaml:
# --
# host1.client.com:
# abc: def
# foo: bar
@romanbarczynski
romanbarczynski / agent.rb
Created March 1, 2011 17:05
now it's working
module MCollective
module Agent
class Mysql<RPC::Agent
metadata ....
action "createdb" do
status = 'Unknown'
begin
>> code that fails for unknown reason <<
rescue StandardError => e