Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
# https://gist.github.com/jeansch/e374046836082aed5851f9015d1b21eb
import apt
print "\n".join(p.name for p in apt.Cache() if p.installed
and not p.versions[p.installed].origins[0].trusted
and len(p.versions) > 1)
@jeansch
jeansch / sin.py
Last active September 7, 2017 14:47
Play a 440Hz sinus
from array import array
from time import sleep
import math
import pygame
from pygame.mixer import Sound, get_init, pre_init
class Note(Sound):
@jeansch
jeansch / keybase.md
Created November 20, 2014 21:45
Keybase proof

Keybase proof

I hereby claim:

  • I am jeansch on github.
  • I am jeansch (https://keybase.io/jeansch) on keybase.
  • I have a public key whose fingerprint is 21D0 4702 758D 5656 C0D6 3288 1609 9E15 596A E928

To claim this, I am signing this object:

@jeansch
jeansch / sso
Created May 16, 2014 19:49
Change pulseaudio default output and switch currently playing programs to that output
#!/usr/bin/env python
import sys
import subprocess
default_index = None
current_sink = None
outputs = {}
sinks, _ = subprocess.Popen('pacmd list-sinks', shell=True,
stdout=subprocess.PIPE).communicate()
@jeansch
jeansch / pyc
Created September 18, 2013 20:31
Invoke Pep8, pylint and pyflakes.
#!/usr/bin/python
# Invoke Pep8, pylint and pyflakes.
import sys
from pkg_resources import load_entry_point
from pyflakes.scripts.pyflakes import main as pyflakes_main
import re
from subprocess import *
@jeansch
jeansch / hg-flat-log
Created September 18, 2013 20:29
Display flattened mercurial history.
#!/usr/bin/env python
# Display flattened mercurial history.
from mercurial import hg, ui
from datetime import datetime
uiface = ui.ui()
repo = hg.repository(uiface, '.')
ctxs = []
@jeansch
jeansch / gsettings-dump
Created September 18, 2013 20:26
Dump gsettings.
#!/bin/sh
# Dump gsettings
for s in $(gsettings list-schemas); do
for k in $(gsettings list-keys $s); do
echo -n "$s.$k = "; gsettings get $s $k;
done;
done