Skip to content

Instantly share code, notes, and snippets.

@edevil
edevil / geventfd.py
Created June 18, 2012 08:57 — forked from wolever/geventfd.py
Simple wrapper around a file descriptor which will perform non-blocking reads/writes using gevent
import os
import fcntl
from gevent.core import wait_read, wait_write
class GeventFD(object):
""" Wrap a file descriptor so it can be used for non-blocking reads and writes with gevent.
>>> stdin = GeventFD(sys.stdin.fileno())
>>> stdin.read(5)
'hello'
@edevil
edevil / phoenix-app.service
Created February 12, 2016 12:49 — forked from kzkin/phoenix-app.service
systemd service for phoenix framework release (exrm)
# Phoenix Framework - A productive web framework that does not compromise speed and maintainability
[Unit]
Description=Phoenix Framework ISControl Application
After=network.target
[Service]
Type=simple
User=deployer
RemainAfterExit=yes
Mar 22 18:40:04 ubuntu docker[35378]: time="2016-03-22T18:40:04.296241605Z" level=error msg="Couldn't run auplink before unmount: exec: \"auplink\": executable file not found in $PATH"
Mar 22 18:40:04 ubuntu kernel: [ 4730.637950] aufs au_opts_verify:1597:docker[35720]: dirperm1 breaks the protection by the permission bits on the lower branch
Mar 22 18:40:04 ubuntu docker[35378]: time="2016-03-22T18:40:04.319228808Z" level=error msg="Couldn't run auplink before unmount: exec: \"auplink\": executable file not found in $PATH"
Mar 22 18:40:04 ubuntu kernel: [ 4730.661698] aufs au_opts_verify:1597:docker[35720]: dirperm1 breaks the protection by the permission bits on the lower branch
Mar 22 18:40:04 ubuntu kernel: [ 4730.692520] aufs au_opts_verify:1597:docker[35720]: dirperm1 breaks the protection by the permission bits on the lower branch
Mar 22 18:40:04 ubuntu docker[35378]: time="2016-03-22T18:40:04.795684844Z" level=error msg="Couldn't run auplink before unmount: exec: \"auplink\": executable file not found
@edevil
edevil / stress.yaml
Created July 1, 2016 08:17 — forked from sercand/stress.yaml
Kubernetes Stress Job
apiVersion: batch/v1
kind: Job
metadata:
name: pi-with-timeout
spec:
parallelism: 20
completions: 100
template:
metadata:
name: pi
[Unit]
Description=Copy CIFS mount
After=network.target
[Service]
Type=oneshot
RemainAfterExit=yes
TimeoutStartSec=0
ExecStart=/bin/sh -c "rm -fr /opt/sbin && rsync -a /usr/sbin/ /opt/sbin/ && /usr/bin/docker run -v /opt/sbin:/target so0k/mount.cifs_copy /target && mount --bind /opt/sbin/ /usr/sbin/"
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@edevil
edevil / start.sh
Created October 27, 2016 10:09 — forked from camshaft/start.sh
elixir startup script with graceful shutdown
#!/bin/bash
HOSTNAME="localhost"
PORT=${PORT-4000}
NODE="app_$PORT"
if [ -z "$COOKIE" ]
then
COOKIE=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
fi

Keybase proof

I hereby claim:

  • I am edevil on github.
  • I am edevil (https://keybase.io/edevil) on keybase.
  • I have a public key ASBbkeyvsJe97e13cEqm0O2ucO8FkKSc9av1LSTuxA1WUgo

To claim this, I am signing this object:

0xF7522868e935c6fcdA543e3baC78495dB884EE3b
@edevil
edevil / Gopkg.toml
Created January 8, 2018 17:26
Dep strangeness
# Gopkg.toml example
#
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
# for detailed Gopkg.toml documentation.
#
# required = ["github.com/user/thing/cmd/thing"]
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
#
# [[constraint]]