Skip to content

Instantly share code, notes, and snippets.

View kouk's full-sized avatar

Konstantinos Koukopoulos kouk

View GitHub Profile

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
@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 / 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
@kouk
kouk / igrouper-test.py
Created November 11, 2016 15:13
Consume an iterable in chunks, skipping what's not needed. Similar to the "grouper" recipe in https://docs.python.org/2/library/itertools.html#recipes
from itertools import islice
from igrouper import igrouper
test = []
for batch in list(igrouper(range(24), 5)):
test.append(list(batch))
assert test == [[], [], [], [], []]
2018/09/25 14:14:32 [INFO] Terraform version: 0.11.7 41e50bd32a8825a84535e353c3674af8ce799161
2018/09/25 14:14:32 [INFO] Go runtime version: go1.10.1
2018/09/25 14:14:32 [INFO] CLI args: []string{"/bin/terraform", "apply"}
2018/09/25 14:14:32 [DEBUG] Attempting to open CLI config file: /home/ansible/.terraformrc
2018/09/25 14:14:32 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2018/09/25 14:14:32 [INFO] CLI command args: []string{"apply"}
2018/09/25 14:14:32 [INFO] command: empty terraform config, returning nil
2018/09/25 14:14:32 [DEBUG] command: no data state file found for backend config
2018/09/25 14:14:32 [DEBUG] New state was assigned lineage "2adf3ae4-aa99-0739-0027-8b17ae7c3762"
2018/09/25 14:14:32 [INFO] command: backend initialized: <nil>
@kouk
kouk / Dockerfile
Created April 11, 2019 08:47
Run google meet in chrome via docker with user namespace
FROM jess/chrome
USER root
# Add chrome user
RUN groupadd -r -g 1001 kouk && useradd -r -g kouk -u 1001 -G audio,video kouk \
&& mkdir -p /home/kouk/Downloads && chown -R kouk:kouk /home/kouk
USER kouk