Skip to content

Instantly share code, notes, and snippets.

View einyx's full-sized avatar

alessio einyx

  • PID 1
View GitHub Profile
@einyx
einyx / gist:573d53a6d087df6a40b2
Last active August 29, 2015 14:20
force bluetooth restart on mac
All of the following will require sudo if run from the command line:
defaults write /Library/Preferences/com.apple.Bluetooth.plist ControllerPowerState 0
#set bluetooth pref to off
defaults write /Library/Preferences/com.apple.Bluetooth.plist ControllerPowerState 1
#set bluetooth pref to on
DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -I/usr/include/libxml2 -I/private/var/folders/0b/fjlqmqr15y5755cl1kqsj1700000gn/T/pip-build-9egv3x/lxml/src/lxml/includes -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/lxml/lxml.etree.c -o build/temp.macosx-10.10-intel-2.7/src/lxml/lxml.etree.o -w -flat_namespace
In file included from src/lxml/lxml.etree.c:239:
/private/var/folders/0b/fjlqmqr15y5755cl1kqsj1700000gn/T/pip-build-9egv3x/lxml/src/lxml/includes/etree_defs.h:14:10: fatal error: 'libxml/xmlversion.h' file not found
#include "libxml/xmlversion.h"
^
1 error generated.
error: command 'cc' failed with exit status 1
================ SOLUTION
@einyx
einyx / gist:d77406f7dfd5ae5f79f4
Last active August 29, 2015 14:21
ssl iam aws
openssl genrsa -out something-staging.pem 2048
openssl req -sha256 -new -key something-staging.pem -out something-staging.csr
openssl x509 -req -days 3650 -in something-staging.csr -signkey something-staging.pem -out something-staging-self.pem
aws iam upload-server-certificate --server-certificate-name something-staging --certificate-body file://something-staging-self.pem --private-key file://something-staging.pem
#!/bin/sh
# Setup encrypted disk image
# For Ubuntu 14.04 LTS
CRYPTFS_ROOT=/home/cryptfs
apt-get update
apt-get -y upgrade
apt-get -y install cryptsetup
@einyx
einyx / gist:6c9a9dd38f33a0183e7d
Last active August 29, 2015 14:21
shmmax docker not propagated
I've tracked this down. A change went into Linux kernel V3.16 which fixes this.
Previously, the shared memory allocated to containers was hard-coded to 32 MB, and now it's set much higher.
boot2docker keeps pretty up-to-date on kernel versions, which is why it works there.
If you're not able to upgrade your kernel, then one alternative is to give your
container access to the host's IPC namespace using the --ipc host option on docker run.
This is a security risk as it breaks the isolation of your container, but it is an option.
@einyx
einyx / gist:5c559055c17f1e59bff7
Last active August 29, 2015 14:21
vpn setup docker
OVPN_DATA=openvpn-data
docker run --name $OVPN_DATA -v /etc/openvpn busybox
docker run --volumes-from $OVPN_DATA --rm einyx/vpn:v1 ovpn_genconfig -u udp://vpn..com
docker run --volumes-from $OVPN_DATA --rm -it einyx/vpn:v1 ovpn_initpki
docker run --volumes-from $OVPN_DATA -d -p 1194:1194/udp --cap-add=NET_ADMIN einyx/vpn:v1
docker run --volumes-from $OVPN_DATA --rm -it einyx/vpn:v1 easyrsa build-client-full work
docker run --volumes-from $OVPN_DATA --rm einyx/vpn:v1 ovpn_getclient work > work.ovpn
#!/bin/sh
# Setup encrypted disk image
# For Ubuntu 14.04 LTS
CRYPTFS_ROOT=/home/cryptfs
if ! dpkg-query -W cryptsetup; then
apt-get update
apt-get -y upgrade
apt-get -y install cryptsetup
openssl genrsa -out com.key 2048
openssl req -new -key com.key -out com.csr -config /usr/local/etc/openssl/openssl.cnf
openssl x509 -req -days 3650 -in com.csr -signkey com.key -out com.crt
NAME=einyx/casperjs
VERSION=latest
default:
@echo Please use \'make build\' or \'make test example.js\'
build:
docker build -t $(NAME):$(VERSION) .
NAME = einyx/cli53
all : build
.built : .
docker build -t $(NAME) .
@docker inspect -f '{{.Id}}' $(NAME) > .built
build : .built