Skip to content

Instantly share code, notes, and snippets.

View sputnikus's full-sized avatar

Martin Putniorz sputnikus

  • Freelance
  • Brno, Czech Republic
View GitHub Profile
@sputnikus
sputnikus / gist:1014627
Created June 8, 2011 15:20
Deployment process on OpenShift
# generic install and usage of rhc
# install rhc gem
export RB_USER_INSTALL=true
export PATH=$PATH:/home/holly/.gem/ruby/1.8/bin
gem install --user-install --source http://gems.rubyforge.org --source https://openshift.redhat.com/app/repo/ rhc
# json-1.5.1
# parseconfig-0.5.2
# rhc-0.69.3
@sputnikus
sputnikus / gist:1051067
Created June 28, 2011 12:51
For the sake of Caps Lock day
#!/bin/sh
#
# Caps Lock killer
#
case "$1" in
deactivate)
xmodmap -e "remove lock = Caps_Lock"
;;
activate)
@sputnikus
sputnikus / gist:1095164
Created July 20, 2011 15:23
Google Translate command line
#!/bin/bash
if [ $# == 3 ]; then
echo "From: $1 To: $2"
lynx -dump "http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=$3&langpair=$1|$2"|awk -F'"' '{print $6}'
else
lynx -dump "http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=$1&langpair=|cs"|awk -F'"' '{print "From: "$10" To: cs \n"$6}';echo
lynx -dump "http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=$1&langpair=|en"|awk -F'"' '{print "From: "$10" To: en \n"$6}';echo
@sputnikus
sputnikus / gist:1118303
Created August 1, 2011 15:10
Archlinux update
echo blacklist acer-wmi | sudo tee -a /etc/modprobe.d/blacklist-acer-wmi.conf
echo softdep intel_ips pre: i915 | sudo tee -a /etc/modprobe.d/blacklist-acer-wmi.conf
@sputnikus
sputnikus / about.md
Created August 10, 2011 14:22 — forked from blaix/about.md
Programming Achievements: How to Level Up as a Developer

Programming Achievements: How to Level Up as a Developer

  1. Select a particular experience to pursue.
  2. Pursue that experience to completion. (Achievement unlocked!)
  3. Reflect on that experience. Really soak it in. Maybe a blog post would be in order?
  4. Return to Step 1, this time selecting a new experience.

This gist is a fork of the gist from this blog post.

@sputnikus
sputnikus / matrix_multiply.py
Created November 6, 2011 23:20
Too lazy for serious math...
from pprint import pprint
def zero(m, n):
new_matrix = [[0 for row in range(n)] for col in range(m)]
return new_matrix
def mult(matrix1, matrix2):
if len(matrix1[0]) != len(matrix2):
@sputnikus
sputnikus / simple_as_hell.py
Created November 7, 2011 18:10
SOAP in Python - examples
import logging
from rpclib.application import Application
from rpclib.decorator import srpc
from rpclib.service import ServiceBase
from rpclib.model.primitive import String
from rpclib.model.primitive import Integer
from rpclib.model.complex import Iterable
from rpclib.interface.wsdl import Wsdl11
from rpclib.protocol.soap import Soap11
@sputnikus
sputnikus / egg_info_error.sh
Created November 21, 2011 13:14
Something wrong is going on...
λ ~/aur/requests-0.8.2/ python2 setup.py egg_info
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'install_requires'
warnings.warn(msg)
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: invalid command 'egg_info'
λ ~/ uname -a
@sputnikus
sputnikus / fib.py
Created November 22, 2011 15:40
Speed kills
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
from math import sqrt
def fibonacci(n):
root5 = sqrt(5)
phi = 0.5 + root5 / 2
@sputnikus
sputnikus / README.md
Created September 19, 2012 08:01 — forked from agnoster/README.md
My ZSH Theme

agnoster.zsh-theme

A ZSH theme optimized for people who use:

  • Solarized
  • Git
  • Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)

Compatibility