Skip to content

Instantly share code, notes, and snippets.

View volure's full-sized avatar

Volure DarkAngel volure

View GitHub Profile
hdiutil attach /Applications/Install\ OS\ X\ El\ Capitan.app/Contents/SharedSupport/InstallESD.dmg -noverify -nobrowse -mountpoint /Volumes/install_app
hdiutil convert /Volumes/install_app/BaseSystem.dmg -format UDSP -o /tmp/El\ Capitan
hdiutil resize -size 9g /tmp/El\ Capitan.sparseimage
hdiutil attach /tmp/El\ Capitan.sparseimage -noverify -nobrowse -mountpoint /Volumes/install_build
rm /Volumes/install_build/System/Installation/Packages
#!/bin/bash
#usage
# ./search.sh "(uid=person)" mail
# returns the "mail" value from uid person
ldaphost=ldap://server:389
ldapuser=cn=config
ldappass=password_hele
@volure
volure / BASH: Useful Commands
Last active October 6, 2017 21:36
BASH: Useful Commands
# Find Replace in files
find /path -type f -iname "*.txt" -exec sed -i.bak 's/foo/bar/g' "{}" +;
# Get a .gitignore with common ignore patterns
wget -O - https://www.gitignore.io/api/intellij,node,eclipse,visualstudio,linux,osx,windows,elasticbeanstalk > .gitignore
@volure
volure / BASH: iptables router over openvpn
Last active October 6, 2017 21:36
BASH: iptables router over openvpn
iptables -t nat -A POSTROUTING -j MASQUERADE
iptables -I INPUT -s 10.0.0.0/8 -j ACCEPT
iptables -I FORWARD -s 10.0.0.0/8 -j ACCEPT
iptables -I FORWARD -d 10.0.0.0/8 -j ACCEPT
#sysctl -w net.ipv4.ip_forward=1
iptables -I INPUT -i tun+ -j ACCEPT
iptables -I FORWARD -i tun+ -j ACCEPT
@volure
volure / BASH: cat using pipes for the input and the output
Last active October 6, 2017 21:36
BASH: cat using pipes for the input and the output
#This may be a little misleading because the */cmd/in is input to the pipe, therefore output from cat.
#therefore */cmd/out is output from the pipe, and therefore input from cat.
cat >/tmp/com.thelazycoder.PipesBomb/cmd/in|tee </tmp/com.thelazycoder.PipesBomb/cmd/out
# This can be used with input and output from command line executables as well.
@volure
volure / SSH: Create new email user with linked mail folder
Created June 1, 2015 13:54
SSH: Create new email user with linked mail folder
#!/bin/sh
whoami=`whoami`
if [ $whoami == 'root' ]; then
echo "Generating New Email User"
useradd -G emailusers $1
echo "Creating Directory in Share"
mkdir -p /space/home/$1/Maildir
echo "Setting ownership to $1:$1"
@volure
volure / OSX: Setup Sublime Text 3
Last active October 6, 2017 21:36
OSX: Setup Sublime Text 3
Add Open With Sublime Service.
1. Open Automator.
2. New Service as "Shell Script"
3. /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl -n $$
4. Save as "Open In Sublime"
Add Command Functionality to open in sublime text
@volure
volure / SSH: Self Sign Postfix
Last active September 22, 2023 17:49
Create a Self Signed Postfix Certificate
# copied from https://www.e-rave.nl/create-a-self-signed-ssl-key-for-postfix
openssl genrsa -des3 -out mail.domain.tld.key 2048
chmod 600 mail.domain.tld.key
openssl req -new -key mail.domain.tld.key -out mail.domain.tld.csr
openssl x509 -req -days 365 -in mail.domain.tld.csr -signkey mail.domain.tld.key -out mail.domain.tld.crt
openssl rsa -in mail.domain.tld.key -out mail.domain.tld.key.nopass
mv mail.domain.tld.key.nopass mail.domain.tld.key
openssl req -new -x509 -extensions v3_ca -keyout cakey.pem -out cacert.pem -days 3650
chmod 600 mail.domain.tld.key
@volure
volure / SSH: apache permission command
Created May 22, 2015 23:26
Allow Apache to use a folder with Change Security Context Command
chcon -R --reference=/var/www/html/ /var/www/html/anotherFolder