Skip to content

Instantly share code, notes, and snippets.

View corny's full-sized avatar

Julian Kornberger corny

View GitHub Profile
@tdussa
tdussa / failover.md
Last active April 11, 2024 10:29
MikroTik failover routing description (living document)

MikroTik Routing Failover

This is meant to be a somewhat-easier-to-digest recap of the discussion that can be found on the MikroTik forum at this URL: https://forum.mikrotik.com/viewtopic.php?f=23&t=157048&p=836497&hilit=failover#p836497 Note that the forum discussion not only addresses failover, but also load balancing at the same time (without explicitly saying so in the beginning).

For the sake of this document, we'll make some assumptions:

@codref
codref / go-ssh-reverse-tunnel.go
Last active October 23, 2023 13:32
Go SSH reverse tunnel implementation (SSH -R)
/*
Go-Language implementation of an SSH Reverse Tunnel, the equivalent of below SSH command:
ssh -R 8080:127.0.0.1:8080 operatore@146.148.22.123
which opens a tunnel between the two endpoints and permit to exchange information on this direction:
server:8080 -----> client:8080
@VimleshS
VimleshS / ruby_cert.rb
Created August 30, 2016 09:35
Usage examples of ruby’s openssl lib
#Reference
#https://devnotcorp.wordpress.com/2012/08/21/usage-examples-of-rubys-openssl-lib/
#!/usr/bin/ruby
require 'openssl'
require 'date'
require 'time'
@lukechilds
lukechilds / get_latest_release.sh
Created August 9, 2016 19:43
Shell - Get latest release from GitHub
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}
# Usage
# $ get_latest_release "creationix/nvm"
# v0.31.4
@iamralch
iamralch / sshtunnel.go
Last active April 16, 2023 03:07
SSH tunnelling in Golang
package main
import (
"log"
"bufio"
"time"
"os"
"fmt"
"io"
"net"
@j3tm0t0
j3tm0t0 / config.boot
Last active December 1, 2017 21:59
Vyatta static routing with redundancy VPN configuration for Amazon VPC
interfaces {
ethernet eth0 {
address x.x.x.50/30
duplex auto
hw-id 00:0c:29:8e:f1:58
smp_affinity auto
speed auto
}
ethernet eth2 {
address 172.31.1.50/16
@puppe
puppe / absender.lco
Last active July 30, 2023 20:14
Deutsche Briefvorlage für LaTeX (scrlttr2) (ACHTUNG: Aktualisierte Version jetzt unter https://codeberg.org/puppe/german-latex-letter-template/)
\ProvidesFile{absender.lco}
\KOMAoptions{%
% fromemail=true, % Email wird im Briefkopf angezeigt
% fromphone=true, % Telefonnumer wird im Briefkopf angezeigt
% fromfax=true, % Faxnummer wird im Briefkopf angezeit
% fromurl=true, % URL wird im Briefkopf angezeigt
% fromlogo=true, % Logo wird im Briefkopf angezeigt
% subject=titled, % Druckt "Betrifft: " vor dem Betreff
locfield=wide, % Breite Absenderergänzung (location)
@jotto
jotto / google_oauth2_access_token.rb
Created June 14, 2012 21:15
ruby command line script for generating google oauth2 access token
# (create oauth2 tokens from Google Console)
client_id = ""
client_secret = ""
# (paste the scope of the service you want here)
# e.g.: https://www.googleapis.com/auth/gan
scope = ""
@mceachen
mceachen / .travis.yml
Created April 9, 2012 01:28
Travis CI with multiple database engines
language: ruby
rvm:
- 1.9.3
env:
- DB=sqlite
- DB=mysql
- DB=postgresql
@corny
corny / replace_secret_token.rb
Created March 17, 2012 11:08
Rake task to replace the secret token in your config/initializers/secret_token.rb
#
# License: WTFPL (http://sam.zoy.org/wtfpl/)
#
namespace :secret do
desc 'Replace the secure secret key in your secret_token.rb'
task :replace do
pattern = /(\.secret_token *= *')\w+(')/
secret = SecureRandom.hex(64)
filepath = "#{Rails.root}/config/initializers/secret_token.rb"