Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am ivgiuliani on github.
  • I am kratorius (https://keybase.io/kratorius) on keybase.
  • I have a public key whose fingerprint is 979F 957D A898 C9C1 36C5 2C1D 0766 1FBC FBC9 72D6

To claim this, I am signing this object:

@ivgiuliani
ivgiuliani / make-ovpn.py
Created October 30, 2013 08:01
Creates openvpn .ovpn files from the various config file (openvpn.conf, ca.crt, ta.key, client.crt and client.key).
#!/usr/bin/env python
import sys
def embed(content_iter, title=None):
if title:
sys.stdout.write("<%s>\n" % title)
for line in content_iter:
sys.stdout.write(line)
if title:
sys.stdout.write("</%s>\n" % title)
@ivgiuliani
ivgiuliani / android-kvm-howto.md
Created October 8, 2013 09:40
How to enable kvm extensions for the Android emulator

Check that your CPU supports hardware virtualization:

egrep –c ‘(vmx|svm)’ /proc/cpuinfo

Check if your processor supports kvm:

sudo apt-get install cpu-checher
tuborg:~ $ kvm-ok

INFO: /dev/kvm exists

@ivgiuliani
ivgiuliani / colorinterpolation.py
Created June 22, 2013 10:00
Linearly interpolates through the specified colors with the given number of steps. For example, if 'colorpoints' is [A, B, C] and 'steps' is [3, 10], this function will generate a list of 13 color points in the RGB spectrum, with the first 3 points representing colors going from color A to color B (so basically color A, some intermediate gradien…
import colorsys
def color_interpolation(colorpoints, steps, use_hsv=True):
"""Generates a color sequence interpolating through color points.
Iterates from/to each given color point in the number of steps specified.
For example, if `colorpoints` is [A, B, C] and `steps` is [3, 10], this
function will generate a list of 13 color points in the RGB spectrum, with
the first 3 points representing colors going from color A to color B
(so basically color A, some intermediate gradient, and color B) and the
import sys
"""
This is my take at solving this interview question:
You are working on a crossword, and become fixated with one of the words.
You have some of its letters figured out so far, but not all of them. E.g.:
"A.GO...H."
That, and a dictionary, are your inputs.
Your output must be the set of words that are plausible solutions.
#!/usr/bin/env python
"""
Given a list of stopwords and a simple text file, this script
extracts bigrams. Example:
./bigrams.py nietzsche-zarathustra.txt
great: ['noontide']
petty: ['people']
love: ['thee']
voluntary: ['beggar']