Skip to content

Instantly share code, notes, and snippets.

View kouk's full-sized avatar

Konstantinos Koukopoulos kouk

View GitHub Profile
@kouk
kouk / gist:6184466
Created August 8, 2013 13:14
repeated run of pkgng empties out {digests,packagesite}.txz.
ipanic:/tmp/testrepo$ ls -l
total 1
-rw-r--r-- 1 kouk wheel 1689644 Aug 8 16:10 pkg-1.1.4_1.txz
ipanic:/tmp/testrepo$ pkg repo .
Generating repository catalog in .: done!
ipanic:/tmp/testrepo$ ls -l
total 1669
-rw-r--r-- 1 kouk wheel 260 Aug 8 16:10 digests.txz
-rw-r--r-- 1 kouk wheel 600 Aug 8 16:10 packagesite.txz
-rw-r--r-- 1 kouk wheel 1689644 Aug 8 16:10 pkg-1.1.4_1.txz
@kouk
kouk / b58id-pycrypto
Last active December 23, 2015 06:29
base58 ID with AES (pyCrypto)
from Crypto.Cipher import AES
from base58 import b58encode
shard = {'id': 5, 'pw': 'myshardpw16bytes'}
id = "%016d-" % shard['id']
id += AES.new('myshardpw16bytes').encrypt("%016d"%1)
assert b58encode(id) == 'FKGJyhKSHVaem5JbQqmBLTcgHzBtp7D3UGZPuPqSB8PN9'
ּ_בּ
בּ_בּ
טּ_טּ
כּ‗כּ
לּ_לּ
מּ_מּ
סּ_סּ
תּ_תּ
٩(×̯×)۶
٩(̾●̮̮̃̾•̃̾)۶
$ brew install gfortran
Warning: Building source; cellar of gfortran's bottle is /usr/local/Cellar
==> Downloading http://ftpmirror.gnu.org/gcc/gcc-4.8.1/gcc-4.8.1.tar.bz2
Already downloaded: /opt/boxen/cache/homebrew/gfortran-4.8.1.tar.bz2
==> ../configure --prefix=/opt/boxen/homebrew/Cellar/gfortran/4.8.1/gfortran --datarootdir=/opt/boxen/homebrew/Cellar/gfortran/4.8.1/share --bindir=/opt/boxen/homebrew/Cellar/gfortran/4.8.1/bin --enabl
==> make bootstrap
Bootstrap comparison failure!
x86_64-apple-darwin12.5.0/libstdc++-v3/src/c++98/math_stubs_float.o differs
make[2]: *** [compare] Error 1
make[1]: *** [stage3-bubble] Error 2

Keybase proof

I hereby claim:

  • I am kouk on github.
  • I am kouk (https://keybase.io/kouk) on keybase.
  • I have a public key whose fingerprint is D6BD 52B6 8C99 A91C E2C8 934D 3300 566B 3A46 726E

To claim this, I am signing this object:

@kouk
kouk / ec2ssh.sh
Created May 14, 2014 10:53
ec2ssh.sh
#!/bin/sh
function ec2ssh() {
sshopt="1246AaCfgKkMNnqsTtVvXxYyb:c:D:e:F:I:i:L:l:m:O:o:p:R:S:W:w:"
while getopts $sshopt o ; do done
hostname=region=""
if [ $OPTIND -le $# ] ; then
eval hostarg='$'$OPTIND
$ python foo.py &
[1] 21377
$ gdb -p 21377
GNU gdb (GDB) Fedora 7.7.1-17.fc20
[... gdb loading messages ...]
0x00007f9a09af46e3 in __select_nocancel () at ../sysdeps/unix/syscall-template.S:81
81 T_PSEUDO (SYSCALL_SYMBOL, SYSCALL_NAME, SYSCALL_NARGS)
(gdb) py-bt
#4 Frame 0x22d9c70, for file foo.py, line 12, in forever ()
sleep(1)
@kouk
kouk / connect-to-agent.sh
Last active August 29, 2015 14:08
connect with gpg-agent (with ssh) at all costs
# Tries to connect to a running gpg-agent or starts one itself. It tries connecting to:
# 1. the agent currently designated in the environment,
# 2. the agent designated in the $HOME/.gnupg/gpg-agent-info file,
# 3. the most recently started running gpg-agent process, or last
# 4. a new gpg-agent process, with ssh support and, if applicable, x11 support.
#
# Step no. 3 requires the "pgrep" and "sockstat" utilities (available on FreeBSD)
CONNECTGPG=$(which gpg-connect-agent)
if [ -x $CONNECTGPG ] ; then
@kouk
kouk / Example health-check script with systemd socket activation
Last active March 13, 2023 16:42
Simple HTTP health-check by abusing systemd socket activation with shell scripts
$ curl --dump-header - localhost:12345
HTTP/1.0 404 Not Found
Content-Type: text/html
Content-Length: 43
Date: Fri, 05 Dec 2014 17:48:56 +0000
<html>
<body>
<h1>WUT</h1>
</html>
@kouk
kouk / tmxsync.sh
Last active April 6, 2023 20:52
tmux synchronize-windows
# tmxsync: bring all windows as panes into one window and activate the "synchronize-panes" option
# tmxunsync: split all panes into different windows and deactivate the "synchronize-panes" option.
# Licence:
# To the extent possible under law I, Konstantinos Koukopoulos, have waived all copyright and related or neighboring rights to tmxsync.sh, as describe by the CC0 document:
# http://creativecommons.org/publicdomain/zero/1.0/
# This work is published from: Greece.
tmxsync () {
export _TMUX_SYNC=1;