Skip to content

Instantly share code, notes, and snippets.

View armaanhammer's full-sized avatar

Armaan Roshani armaanhammer

View GitHub Profile

If you want to SSH to a VPS which is running openVPN do the following:
source: https://serverfault.com/questions/659955/allowing-ssh-on-a-server-with-an-active-openvpn-client

Enable

The problem is that the default gateway gets changed by OpenVPN, and that breaks your current SSH connection unless you set up appropriate routes before you start OpenVPN.

What follows works for me. It uses iptables and ip (iproute2). Below, it is assumed that the default gateway interface before OpenVPN is started is "eth0". The idea is to ensure that when a connection to eth0 is made, even if eth0 is not the default gateway interface anymore, response packets for the connection go back on eth0 again.

You could use the same number for the connection mark, firewall mark and routing table. I used distinct numbers to make the diffences between them more apparent.

@armaanhammer
armaanhammer / update_ip_address.sh
Last active January 9, 2019 20:15 — forked from woods/update_ip_address.sh
A cron script to periodically update a DNS record in DNSimple for a dynamic IP address.
#!/bin/bash
#
# When a machine is on a dynamic IP address cable modem, we use this script to
# periodically update DNS with the current record.
#
# Keep the contents of this file secret, since it contains the domain's API
# key. The ID of the record to be updated by hovering over it in DNSimple's
# web interface.
IP_ADDRESS="`curl -s https://icanhazip.com/`"
@armaanhammer
armaanhammer / The Technical Interview Cheat Sheet.md
Created February 17, 2018 10:25 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.