Skip to content

Instantly share code, notes, and snippets.

View akscram's full-sized avatar

Ilya Kharin akscram

  • Juniper Networks
  • Amsterdam
View GitHub Profile
#!/bin/bash
function scheduler() {
local -i fd=$1 worker_id= worker_fd=
# local -a workers=$2
local task=
echo "Scheduler started"
while read task
@akscram
akscram / Makefile
Created August 19, 2013 10:36
Workaround for virtualenv and pip requirements.
LIST_DEFAULT=sample_list.txt
OUT_DEFAULT=fixtures/amd.json
VENV_DIR=.venv
REQRUIREMENTS=requirements.txt
.PHONY: fetch venv requirements
fetch: venv requirements $(OUT_DEFAULT)
$(OUT_DEFAULT): $(LIST_DEFAULT)
. $(VENV_DIR)/bin/activate; ./spider.py -i $(LIST_DEFAULT) -o $(OUT_DEFAULT)
@akscram
akscram / sketch.md
Last active December 25, 2015 21:28
A little bit about how you can refer to code.

Simple and short references to OpenStack code.

Navigation

The format of well-defined URL to some file into SCM can be represented in next format:

git.openstack.org/{repo}/{path}?{modifiers}#{line}

The definition:

import inspect
def print_stack():
print(" -> ".join(
"{0}:{1}".format(stack[1], stack[2])
for stack in inspect.stack()
))
print_stack()
@akscram
akscram / etcd.yaml
Last active November 21, 2016 20:21
The simple definition of a service and a deployment with one instance of etcd.
---
apiVersion: v1
kind: Service
metadata:
name: etcd
labels:
app: etcd
spec:
ports:
d-i debian-installer/locale string en_US
d-i console-setup/ask_detect boolean false
d-i keyboard-configuration/xkb-keymap select us
d-i keyboard-configuration/variant select English (US)
d-i keyboard-configuration/layout select English (US)
d-i netcfg/choose_interface select auto
d-i netcfg/get_hostname string unassigned-hostname
d-i netcfg/get_domain string unassigned-domain
d-i netcfg/wireless_wep string
d-i mirror/country string manual
@akscram
akscram / pypi_iso8601.txt
Created August 25, 2017 08:32
pypi/iso8601
>>> import iso8601
>>> d = iso8601.parse_date("2007-01-25T12:00:00Z")
>>> d
datetime.datetime(2007, 1, 25, 12, 0, tzinfo=<iso8601.Utc>)
>>> df = d.strftime('%Y-%m-%dT%H:%M:%S%Z')
>>> df
'2007-01-25T12:00:00UTC'
>>> d2 = iso8601.parse_date(df)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>