Skip to content

Instantly share code, notes, and snippets.

View rm77's full-sized avatar
💭
(to be) or not (to be) = (to be)

Roy rm77

💭
(to be) or not (to be) = (to be)
  • surabaya, indonesia
View GitHub Profile
@programmer131
programmer131 / Linux Virtualization using Iproute2.md
Last active February 18, 2024 05:08
using linux Iproute2 utility, Setup VLAN, double VLAN, VLAN with outer s-tag, VXLAN, VXLAN inside VXLAN,

How to clear ip addr, link
ip link delete vxlan2
ip addr del 192.168.0.55/24 dev vxlan2
VxLAN setup
Machine 1
ip link add vxlan1 type vxlan id 1 remote 192.168.18.48 dstport 4789 dev wlp2s0
ip link set vxlan1 up
ip addr add 192.168.0.6/24 dev vxlan1
Machine 2
ip link add vxlan1 type vxlan id 1 remote 192.168.18.24 dstport 4789 dev wlp3s0\

@nasirhafeez
nasirhafeez / freeradius-advanced-use-cases.md
Last active May 8, 2024 18:23
FreeRADIUS Advanced Use Cases
@djoreilly
djoreilly / mk-vxlan.sh
Created February 17, 2020 10:08
Linux VxLAN performance test setup script
#!/bin/bash
set -xe
# $0 host dev remote_ip
# host is 1 or 2
# on vmA
# ./mk-vx.sh 1 ens3 10.10.10.9
# on vmB
# ./mk-vx.sh 2 ens3 10.10.10.15
@jnovack
jnovack / break.go
Last active April 4, 2024 15:06
Handle CTRL-C in Golang
package main
import (
"fmt"
"os"
"os/signal"
"syscall"
"time"
)
@aspyct
aspyct / wpa_supplicant.conf
Created September 17, 2018 13:10
Connect to a WPA2 Enterprise network with wpa_supplicant with this .conf file. I used this to connect to my university's wireless network.
# Connect to a WPA2 Enterprise network with wpa_supplicant with this .conf file.
# I used this to connect to my university's wireless network on Arch linux.
# Here's the command I used:
#
# wpa_supplicant -i wlan0 -c ./wpa_supplicant.conf
#
network={
ssid="YOUR_SSID"
scan_ssid=1
sudo modprobe 8021q
lsmod | grep 8021q
ip link add link eth1 name eth1.10 type vlan id 10
https://dougvitale.wordpress.com/2011/12/21/deprecated-linux-networking-commands-and-their-replacements/
@aurbano
aurbano / timeBetween.php
Last active May 13, 2024 01:48
Display the time between two dates in a human readable format (i.e. 3 seconds, 4 days, 1 week... )
<?php
/**
* Calculate the elapsed time between two timestamps
* and display in a pretty human way.
* @param integer $start Initial timestamp
* @param integer $end Final timestamp, set to -1 for current time.
* @return string Formatted elapsed time.
*/
function timeBetween($start, $end=-1){
if($end < 0) $end = time();
@rjeczalik
rjeczalik / building-static-nginx.txt
Created October 19, 2013 15:37
Notes on building nginx as a static binary.
# Building static nginx for teh lulz
#
# basic dependencies
sudo apt-get install libxslt1-dev libxml2-dev zlib1g-dev libpcre3-dev libbz2-dev libssl-dev
# download nginx and openssl
wget http://nginx.org/download/nginx-1.5.6.tar.gz
tar xf nginx-1.5.6.tar.gz; cd nginx-1.5.6
@james2doyle
james2doyle / elapsed-time.php
Last active May 13, 2024 01:37
PHP elapsed time function which takes in a timestamp and spits out a "timeago" sentence.
<?php
function elapsed_time($timestamp, $precision = 2) {
$time = time() - $timestamp;
$a = array('decade' => 315576000, 'year' => 31557600, 'month' => 2629800, 'week' => 604800, 'day' => 86400, 'hour' => 3600, 'min' => 60, 'sec' => 1);
$i = 0;
foreach($a as $k => $v) {
$$k = floor($time/$v);
if ($$k) $i++;
$time = $i >= $precision ? 0 : $time - $$k * $v;
$s = $$k > 1 ? 's' : '';
@tomoconnor
tomoconnor / dhcp-event
Created April 20, 2011 17:09
Thingy for updating powerdns backend when stuff changes
#!/usr/bin/env python
import MySQLdb
import os, sys
import pprint
pp = pprint.PrettyPrinter()
mysql_host = "localhost"
mysql_user = "dbusername"
mysql_pass = "dbpassword"