Skip to content

Instantly share code, notes, and snippets.

View jibitsql.py
#! /usr/bin/env python
from sqlalchemy import create_engine
sqlite = create_engine('sqlite:///:memory:', echo=True)
from sqlalchemy import Table, Column, Integer, String, MetaData, ForeignKey
metadata = MetaData()
from sqlalchemy.sql import select, func
View gist:0f2ebc4298176e416f8c
groovy:000> trait A{ String duh() {"a"}}
===> true
groovy:000> trait B{ String duh() {"b"}}
===> true
groovy:000> class C implements A,B {}
===> true
groovy:000> c = new C()
===> C@797cf65c
groovy:000> def blez(A a){a.duh()+"!"}
===> true
View diffoscope
dario@feynman /tmp> diffoscope v3.3.5-slp.tar.bz2 stackless-335-export.tar.bz2
--- v3.3.5-slp.tar.bz2
+++ stackless-335-export.tar.bz2
│ --- v3.3.5-slp.tar
├── +++ stackless-335-export.tar
│ ├── metadata
│ │ @@ -1,3977 +1,4244 @@
│ │ --rw-r--r-- 0/0 126 2014-07-28 10:49:51 stackless-dev-stackless-c856cc204b1c/.hg_archival.txt
│ │ --rw-r--r-- 0/0 584 2014-07-28 10:49:51 stackless-dev-stackless-c856cc204b1c/.bzrignore
│ │ --rw-r--r-- 0/0 891 2014-07-28 10:49:51 stackless-dev-stackless-c856cc204b1c/.gitignore
View gist:640b3ab00b128fdf3338
[dario@archvm ~]$ python
Python 3.5.1 (default, Dec 7 2015, 12:58:09)
[GCC 5.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 2+2
4
>>>
[dario@archvm ~]$ env PYTHONSTARTUP=a.py python
Python 3.5.1 (default, Dec 7 2015, 12:58:09)
[GCC 5.2.0] on linux
View xen_xldmesg
(XEN) Xen version 4.5.1 (Ubuntu 4.5.1-0ubuntu1.1) (stefan.bader@canonical.com) (gcc (Ubuntu 5.2.1-22ubuntu2) 5.2.1 20151010) debug=n Fri Nov 6 22:29:21 UTC 2015
(XEN) Bootloader: GRUB 2.02~beta2-29
(XEN) Command line: placeholder no-real-mode edd=off pci=biosirq
(XEN) Video information:
(XEN) VGA is text mode 80x25, font 8x16
(XEN) Disc information:
(XEN) Found 0 MBR signatures
(XEN) Found 0 EDD information structures
(XEN) Multiboot-e820 RAM map:
(XEN) 0000000000000000 - 0000000000058000 (usable)
View xen_dmesg3
[ 0.000000] x86/PAT: Configuration [0-7]: WB WT UC- UC WC WP UC UC
[ 0.000000] Initializing cgroup subsys cpuset
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Initializing cgroup subsys cpuacct
[ 0.000000] Linux version 4.2.0-18-generic (buildd@lgw01-38) (gcc version 5.2.1 20151010 (Ubuntu 5.2.1-22ubuntu2) ) #22-Ubuntu SMP Fri Nov 6 18:25:50 UTC 2015 (Ubuntu 4.2.0-18.22-generic 4.2.3)
[ 0.000000] Command line: placeholder root=UUID=f3feacbe-ef73-430f-937d-e1232da77e68 ro rootflags=subvol=@ quiet splash pci=biosirq
[ 0.000000] KERNEL supported cpus:
[ 0.000000] Intel GenuineIntel
[ 0.000000] AMD AuthenticAMD
[ 0.000000] Centaur CentaurHauls
View xen_dmesg
[ 0.000000] x86/PAT: Configuration [0-7]: WB WT UC- UC WC WP UC UC
[ 0.000000] Initializing cgroup subsys cpuset
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Initializing cgroup subsys cpuacct
[ 0.000000] Linux version 4.2.0-18-generic (buildd@lgw01-38) (gcc version 5.2.1 20151010 (Ubuntu 5.2.1-22ubuntu2) ) #22-Ubuntu SMP Fri Nov 6 18:25:50 UTC 2015 (Ubuntu 4.2.0-18.22-generic 4.2.3)
[ 0.000000] Command line: placeholder root=UUID=f3feacbe-ef73-430f-937d-e1232da77e68 ro rootflags=subvol=@ quiet splash acpi=off
[ 0.000000] KERNEL supported cpus:
[ 0.000000] Intel GenuineIntel
[ 0.000000] AMD AuthenticAMD
[ 0.000000] Centaur CentaurHauls
View decode_json.py
import json
from collections import namedtuple
Duh = namedtuple('Duh', 'foo bar')
json.loads('{"foo":1, "bar":2}', object_hook=lambda x: Duh(**x))
@berdario
berdario / cabal.config
Created Oct 12, 2015
Hackage server cabal.config (generated from `stack list-dependencies` and manually adding packages whose version was unknown)
View cabal.config
constraints: Cabal ==1.22.4.0,
HStringTemplate ==0.8.3,
HTTP ==4000.2.20,
HUnit ==1.3.0.0,
HaXml ==1.25.3,
QuickCheck ==2.8.1,
SHA ==1.6.4.2,
acid-state ==0.13.0,
aeson ==0.10.0.0,
ansi-terminal ==0.6.2.3,
@berdario
berdario / cabal.config
Created Oct 12, 2015
Hackage-server cabal freeze
View cabal.config
constraints: Cabal ==1.22.4.0,
HStringTemplate ==0.8.3,
HTTP ==4000.2.20,
HaXml ==1.25.3,
QuickCheck ==2.8.1,
SHA ==1.6.4.2,
acid-state ==0.13.0,
aeson ==0.10.0.0,
ansi-terminal ==0.6.2.3,
appar ==0.1.4,