Skip to content

Instantly share code, notes, and snippets.

View RafalSladek's full-sized avatar

Rafal Sladek RafalSladek

  • AutoScout24
  • Munich, Germany
View GitHub Profile
@RafalSladek
RafalSladek / mount_smbfs.sh
Created May 14, 2017 10:02 — forked from natritmeyer/mount_smbfs.sh
How to mount and unmount a SMB share on Mac OS X (using mount_smbfs)
#Mounting the share is a 2 stage process:
# 1. Create a directory that will be the mount point
# 2. Mount the share to that directory
#Create the mount point:
mkdir share_name
#Mount the share:
mount_smbfs //username:[email protected]/share_name share_name/
@RafalSladek
RafalSladek / setupVpn.sh
Last active July 9, 2017 15:01 — forked from nodesocket/vpnsetup.sh
install ipsec vpn
wget https://git.io/vpnsetup -O vpnsetup.sh && sudo \
VPN_IPSEC_PSK='your_ipsec_pre_shared_key' \
VPN_USER='your_vpn_username' \
VPN_PASSWORD='your_vpn_password' sh vpnsetup.sh

Raspberry Pi VPN Router

This is a quick-and-dirty guide to setting up a Raspberry Pi as a "router on a stick" to PrivateInternetAccess VPN.

Requirements

Install Raspbian Jessie (2016-05-27-raspbian-jessie.img) to your Pi's sdcard.

Use the Raspberry Pi Configuration tool or sudo raspi-config to:

@RafalSladek
RafalSladek / passwordGen
Created July 9, 2017 15:00
random password generator for linux
openssl rand -base64 32
date | md5sum
@RafalSladek
RafalSladek / vpnSetup
Created July 9, 2017 15:04
setup vpn with ipsec with own subnet
#!/bin/sh
#
# Script for automatic setup of an IPsec VPN server on Ubuntu LTS and Debian.
# Works on any dedicated server or virtual private server (VPS) except OpenVZ.
#
# DO NOT RUN THIS SCRIPT ON YOUR PC OR MAC!
#
# The latest version of this script is available at:
# https://github.com/hwdsl2/setup-ipsec-vpn
#
@RafalSladek
RafalSladek / rerouting_some_ips_over_second_nic.bat
Created July 10, 2017 14:29
how to separate which ips get routed over specific nic under windows
@echo off
rem works for windows server 2008
rem 192.168.43.1 - wifi/tethering over phone (IF 25)
rem 10.0.32.200 - lan (IF 11)
rem delete routes to internet
route delete 0.0.0.0
route delete 0.0.0.0 MASK 0.0.0.0 10.0.32.200 IF 11
route delete 0.0.0.0 MASK 0.0.0.0 192.168.43.1 IF 25
@RafalSladek
RafalSladek / ssh_agent_start.fish
Created July 11, 2017 05:00 — forked from gerbsen/ssh_agent_start.fish
Auto-launching ssh-agent in fish shell
# content has to be in .config/fish/config.fish
# if it does not exist, create the file
setenv SSH_ENV $HOME/.ssh/environment
function start_agent
echo "Initializing new SSH agent ..."
ssh-agent -c | sed 's/^echo/#echo/' > $SSH_ENV
echo "succeeded"
chmod 600 $SSH_ENV
. $SSH_ENV > /dev/null
ssh-keygen -t rsa -b 4096
@RafalSladek
RafalSladek / curlTestUrl.sh
Created August 29, 2017 13:29
test url with curl and evaluate return http code
#!/usr/bin/env bash
set -exuo pipefail
URL="http://www.rafal-sladek.de/"
response=$(curl -sL -w \\n%{http_code} "$URL" | tail -1)
# echo response
if [ "$response" -eq 200 ]
then
echo "OK"
exit 0
@RafalSladek
RafalSladek / cleanUpDocker.fish
Created August 30, 2017 23:30
remove all containers and delete all images
#!/bin/fish
function cleanUpDocker
#Note: containers can also be removed in a non graceful way:
docker container rm -f (docker container ls -aq)
docker image rm -f (docker image ls -q)
end