Skip to content

Instantly share code, notes, and snippets.

View dunkelstern's full-sized avatar
🐢

Johannes Schriewer dunkelstern

🐢
View GitHub Profile
@dunkelstern
dunkelstern / xed.sh
Created March 30, 2012 10:46
xed "reimplementation" to fix broken Xcode 4 xed
#!/bin/bash
if [ "$1" = "-l" ] || [ "$1" = "--line" ] ; then
line=$2
file=$3
else
line=1
file=$1
fi
@dunkelstern
dunkelstern / 3dprinter.txt
Last active August 29, 2015 14:07
3D-Printer part list
5x NEMA 17 a 12: 60 http://www.ebay.de/itm/NEMA-17-stepper-schritt-motor-3D-drucker-printer-reprap-42BYGHW609-CNC/141432916911
Arduino Mega 2560 Nachbau: 12 http://www.dx.com/p/improved-funduino-mega-2560-r3-module-compatible-w-official-arduino-mega-2560-r3-blue-black-256335#.VDr18vl_t8E
4x Stepper Driver DRV8825 a 9 Euro: 36 http://www.dx.com/p/stepstick-drv8825-stepper-motor-driver-carrier-reprap-4-layer-pcb-purple-300270
MK2B Heated Bed: 12 http://www.dx.com/p/robatale-12-24v-dual-power-mk2b-heated-bed-board-for-reprap-3d-printer-red-294026#.VDr2Qfl_t8E
RAMPS Shield Nachbau: 12 http://www.dx.com/p/ramps-1-4-printer-control-reprap-module-for-3d-printer-deep-blue-319585#.VDr2Wvl_t8E
Edelstahl Gewindespindel M6 1 Meter: 5 http://www.amazon.de/GAH-Alberts-484200-Gewindestange-Edelstahl-Gewinde/dp/B008H1AN1U/
12x LM8UU: 12 http://www.amazon.de/12Stk-Linearlager-Kugellager-Rollenlagerungen-Kug
@dunkelstern
dunkelstern / UILabel+AutoLayoutFix.m
Created June 3, 2015 13:09
Fix UILabel not auto-resizing it's height when using autolayout in landscape mode with a multi line label
@import UIKit;
#import "JRSwizzle.h" // <- from cocoapods: https://cocoapods.org/pods/JRSwizzle
// Stackoverflow question: http://stackoverflow.com/questions/17491376/ios-autolayout-multi-line-uilabel
// Answer see: http://stackoverflow.com/a/23696158/518532
@interface UILabel (AutoLayoutFix)
- (void)DST_setBounds:(CGRect)bounds;
@end
@dunkelstern
dunkelstern / giphycat.py
Created March 8, 2016 17:15
Use the inline image functionality of iTerm2 3.0 to display an animated gif from giphy search
#!/usr/bin/python
from __future__ import print_function
import urllib
import json
import sys
import base64
search = urllib.quote(sys.argv[1])
json_data = urllib.urlopen("http://api.giphy.com/v1/gifs/search?q={searchterm}&api_key=dc6zaTOxFJmzC&limit=1".format(searchterm=search)).read()
@dunkelstern
dunkelstern / Project.sublime-project
Created March 21, 2016 02:08
Sublime project file for anarchytools based swift build
{
"folders":
[
{
"path": ".",
"folder_exclude_patterns": [ ".atllbuild", "bin", "user" ],
"file_exclude_patterns": [ ".gitignore" ]
},
],
"build_systems": [
@dunkelstern
dunkelstern / conemu_bash.xml
Created August 6, 2016 22:05
Conemu config for bash
<?xml version="1.0" encoding="utf-8"?>
<key name="Software">
<key name="ConEmu">
<key name=".Vanilla" modified="2016-08-06 22:39:37" build="160724">
<value name="StartType" type="hex" data="02"/>
<value name="CmdLine" type="string" data=""/>
<value name="StartTasksFile" type="string" data=""/>
<value name="StartTasksName" type="string" data="{Bash::bash}"/>
<value name="StartFarFolders" type="hex" data="00"/>
<value name="StartFarEditors" type="hex" data="00"/>
@dunkelstern
dunkelstern / ipsec.conf
Created August 7, 2016 19:00
StrongSWAN ipsec config for IKEv2 VPN
# ipsec.conf - strongSwan IPsec configuration file
config setup
charondebug="ike 4, knl 4, cfg 4, net 4, esp 4, dmn 4, mgr 4"
conn %default
keyexchange=ike
ike=aes128-sha1-modp1024,aes128-sha1-modp1536,aes128-sha1-modp2048,aes128-sha256-ecp256,aes128-sha256-modp1024,aes128-sha256-modp1536,aes128-sha256-modp2048,aes256-aes128-sha256-sha1-modp2048-modp4096-modp1024,aes256-sha1-modp1024,aes256-sha256-modp1024,aes256-sha256-modp1536,aes256-sha256-modp2048,aes256-sha256-modp4096,aes256-sha384-ecp384,aes256-sha384-modp1024,aes256-sha384-modp1536,aes256-sha384-modp2048,aes256-sha384-modp4096,aes256gcm16-aes256gcm12-aes128gcm16-aes128gcm12-sha256-sha1-modp2048-modp4096-modp1024,3des-sha1-modp1024!
esp=aes128-aes256-sha1-sha256-modp2048-modp4096-modp1024,aes128-sha1,aes128-sha1-modp1024,aes128-sha1-modp1536,aes128-sha1-modp2048,aes128-sha256,aes128-sha256-ecp256,aes128-sha256-modp1024,aes128-sha256-modp1536,aes128-sha256-modp2048,aes128gcm12-aes128gcm16-aes256gcm12-aes256gcm16-modp2048-modp4096-modp
@dunkelstern
dunkelstern / vpn.conf
Created August 7, 2016 19:10
sysctl config for ip packet forwarding
# ipv4
net.ipv4.ip_forward=1
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.all.send_redirects = 0
net.ipv4.conf.all.accept_source_route = 0
net.ipv4.conf.default.rp_filter = 0
net.ipv4.conf.default.accept_source_route = 0
net.ipv4.conf.default.send_redirects = 0
net.ipv4.icmp_ignore_bogus_error_responses = 1
@dunkelstern
dunkelstern / rc.local
Created August 7, 2016 19:14
iptables rules for vpn config
# for ISAKMP (handling of security associations)
iptables -A INPUT -p udp --dport 500 --j ACCEPT
# for NAT-T (handling of IPsec between natted devices)
iptables -A INPUT -p udp --dport 4500 --j ACCEPT
# for ESP payload (the encrypted data packets)
iptables -A INPUT -p esp -j ACCEPT
# for the routing of packets on the server
iptables -t nat -A POSTROUTING -j SNAT --to-source %IP% -o eth0
# internet access
iptables -t nat -A POSTROUTING -s 10.0.42.0/24 -o eth0 -m policy --dir out --pol ipsec -j ACCEPT
@dunkelstern
dunkelstern / create_vpn_user.sh
Created August 7, 2016 19:35
Create certificates for a new machine for an IKEv2 vpn
#!/bin/bash
if [ "$1" = "" ] ; then
echo "Usage: $0 <machine_name>"
exit 1
fi
machinename=$1
# configure these to the visible public values of the server