This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
) | |
func flatten(s []interface{}) (r []int) { | |
// type switch already discussed in the tour of go | |
for _, item := range s { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import "babel-polyfill"; | |
var openpgp = require('openpgp'); // use as CommonJS, AMD, ES6 module or via window.openpgp | |
const query = query => document.querySelector(query); | |
const queryAll = query => Array.prototype.slice.apply(document.querySelectorAll(query)); | |
const pub_key = | |
['-----BEGIN PGP PUBLIC KEY BLOCK-----', | |
'Version: GnuPG v2.0.22 (GNU/Linux)', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Stadt,"Post-leitzahl 1)","Fläche in km2 2)",männlich | |
"Berlin, Stadt",10178,891.12,1755700 | |
"Hamburg, Freie und Hansestadt",20038,755.3,886289 | |
"München, Landeshauptstadt",80331,310.71,714112 | |
"Köln, Stadt",50667,405.02,524790 | |
"Frankfurt am Main, Stadt",60311,248.31,363754 | |
"Stuttgart, Landeshauptstadt",70173,207.33,313295 | |
"Düsseldorf, Stadt",40213,217.41,296231 | |
"Dortmund, Stadt",44135,280.71,287897 | |
"Essen, Stadt",45127,210.34,283065 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from bottle import Bottle, auth_basic, request, run | |
app = Bottle() | |
def check(user, passwd): | |
if user == 'oz123': | |
return True | |
return False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
loop = asyncio.get_event_loop() | |
async def hello(): | |
await asyncio.sleep(3) | |
print('Hello!') | |
if __name__ == '__main__': | |
loop.run_until_complete(hello()) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from kombu import Exchange | |
from kombu import Queue | |
from kombu import BrokerConnection | |
class ProduceConsume(object): | |
def __init__(self, exchange_name, **options): | |
exchange = Exchange(exchange_name, type='fanout', durable=False) | |
queue_name = options.get('queue', exchange_name+'_queue') | |
self.queue = Queue(queue_name ,exchange) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
from __future__ import division | |
import math | |
import time | |
import cairo | |
import gi | |
gi.require_version('Gtk', '3.0') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bottle | |
from beaker.middleware import SessionMiddleware | |
session_opts = { | |
'session.type': 'memory', | |
'session.cookie_expires': 300, | |
'session.auto': True | |
} | |
app = SessionMiddleware(bottle.app(), session_opts) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# use this script to initialize work on gentoo install | |
# this is the base for fully installing automatically | |
# we still have lot's of work to do ... | |
# mount everything needed for a working chroot | |
function mount_all(){ | |
mount $1 /mnt/gentoo | |
mount -t proc proc /mnt/gentoo/proc | |
mount --rbind /sys /mnt/gentoo/sys | |
mount --make-rslave /mnt/gentoo/sys |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vagrant@saltmaster:/srv/salt$ vim common/py_packages.sls # edit and mark django for downgrade | |
vagrant@saltmaster:/srv/salt$ sudo salt minion1 state.sls common.py_packages | |
minion1: | |
---------- | |
ID: install_django == 1.8.0 | |
Function: pip.installed | |
Name: django == 1.8.0 | |
Result: True | |
Comment: All packages were successfully installed | |
Started: 08:58:20.748303 |
NewerOlder