Skip to content

Instantly share code, notes, and snippets.

View nikicat's full-sized avatar
🏠
Working from home

Nik B nikicat

🏠
Working from home
View GitHub Profile
@nikicat
nikicat / strongswan.rc
Created July 13, 2012 19:00
Archlinux strongswan 5.0.0 rc.d script
#!/bin/bash
. /etc/rc.conf
. /etc/rc.d/functions
case "$1" in
start)
stat_busy "Starting strongSwan IPsec"
/usr/sbin/ipsec start
if [ $? -gt 0 ]; then
@nikicat
nikicat / PKGBUILD
Created July 13, 2012 19:15
AUR strongswan 5.0.0. PKGBUILD
# Contributor: nikicat <develniks at gmail dot com>
# Contributor: danilo <gezuru at gmail dot com>
# Contributor: Jason Begley <jayray at digitalgoat dot com>
# Contributor: Ray Kohler <ataraxia937 at gmail dot com>
# Maintainer: Daniel Riedemann <daniel.riedemann [at] googlemail [dot] com>
# Maintainer: 458italia <svenskaparadox [at] gmail dot com>
pkgname=strongswan
pkgver=5.0.0
pkgrel=1
@nikicat
nikicat / sbdownload.sh
Created October 22, 2012 19:32
Safebrowsing API downloader
#!/bin/bash
googleurl='safebrowsing.clients.google.com/safebrowsing/downloads'
yandexurl='sba.yandex.net/downloads'
listname='goog-malware-shavar'
if [ "$1" = 'yandex' ]; then
url=$yandexurl
else
@nikicat
nikicat / deb-changelog2git-tag.sh
Created January 28, 2013 00:54
Create git tag from debian/changelog
#!/bin/bash
# You could optionally swap this lines
git checkout `git log -1 --skip 1 debian/changelog | head -1 | sed 's/.* //'`
git tag `head -1 debian/changelog | sed 's/^.* (\(.*\)) .*$/v\1/'`
@nikicat
nikicat / git2dch.sh
Last active August 29, 2021 12:00
Shell script to regenerate debian changelog from git log
#!/bin/sh
sudo apt-get install -y moreutils git-buildpackage
>debian/changelog
prevtag=initial
pkgname=`cat debian/control | grep '^Package: ' | sed 's/^Package: //'`
git tag -l v* | sort -V | while read tag; do
(echo "$pkgname (${tag#v}) unstable; urgency=low\n"; git log --pretty=format:' * %s' $prevtag..$tag; git log --pretty='format:%n%n -- %aN <%aE> %aD%n%n' $tag^..$tag) | cat - debian/changelog | sponge debian/changelog
prevtag=$tag
import pickle
def f1():
def f2(a):
print(a*a)
return f2
with open('f2.pickle', 'w+') as f:
f.write(pickle.dumps(f1()))
@nikicat
nikicat / test.log
Created March 18, 2014 23:05
raava test failure log
$ pypy3 run-tests.py
Exception in thread Splitter::008:
Traceback (most recent call last):
File "/usr/lib/pypy3/lib-python/3/threading.py", line 740, in _bootstrap_inner
self.run()
File "/usr/lib/pypy3/site-packages/gns-0.1-py3.2.egg/raava/splitter.py", line 40, in run
data = self._input_queue.get()
File "/usr/lib/pypy3/site-packages/gns-0.1-py3.2.egg/raava/zoo.py", line 238, in get
return self._client.retry(self._inner_get)
File "/usr/lib/pypy3/site-packages/kazoo-1.3.1-py3.2.egg/kazoo/retry.py", line 122, in __call__
@nikicat
nikicat / docker-build-push.sh
Created June 30, 2014 10:27
shell script to automate Docker image rebuilding
#!/bin/bash -e
dirname=${PWD##*/}
if (echo $dirname | grep docker); then
dirname=${dirname##docker-}
fi
registry=${DOCKER_REGISTRY:=registry.tst.ape.yandex.net:5000}
namespace=${DOCKER_NAMESPACE:=nikicat}
@nikicat
nikicat / job.py
Created July 8, 2014 09:09
gns prototype
import storage # storage interface
class Job:
"""Represents Job - some code to run
Could be used from different processes
to control job execution and status
"""
def __init__(
self,
version: '0123456789abcdefefdcba9876543210',
@nikicat
nikicat / travis.sh
Last active January 6, 2016 10:34
Shell build script to handle .travis.yml inside Jenkins
#!/bin/bash -exv
function getvalue() {
shyaml get-value $1 < .travis.yml
}
function getencvalue() {
shyaml get-value $1.secure < .travis.yml | base64 -d | openssl rsautl -decrypt -inkey .jenkins.pem
}