Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
export LC_ALL=C
get_top_of_version() {
ovs-vsctl get bridge "$1" protocol | sed -n 's/^.*"\([^"]*\)"]$/\1/p'
}
save_flows () {
for bridge; do
@rebeccacremona
rebeccacremona / .bash_profile
Created September 1, 2016 13:46
Eternal bash history
# No dupes
export HISTCONTROL=ignoreboth:erasedups
# Eternal bash history.
# ---------------------
# Undocumented feature which sets the size to "unlimited".
# http://stackoverflow.com/questions/9457233/unlimited-bash-history
export HISTFILESIZE=
export HISTSIZE=
export HISTTIMEFORMAT="%F %T "
@horzadome
horzadome / heupdater.txt
Last active March 6, 2025 22:24
Hurricane Electric IPv6 tunnel updater script for Mikrotik RouterOS
# Update Hurricane Electric IPv6 Tunnel Client IPv4 address
# This is an upgrade to an existing script from
# http://wiki.mikrotik.com/wiki/Hurricane_Electric_IPv6_Tunnel_-_IPv4_Endpoint_updater
# API call format:
# https://#USERNAME:[email protected]/nic/update?username=$USERNAME&password=$API_KEY&hostname=$TUNNEL_ID
# ----------------------------------
# Modify the following to match your parameters
# ----------------------------------
# Router's WAN interface name
@archerslaw
archerslaw / hotplug-via-QMP.py
Last active September 11, 2018 17:11
hotplug-via-QMP.py
# QEMU Monitor Protocol Python class
#
# Copyright (C) 2009 Red Hat Inc.
#
# This work is licensed under the terms of the GNU GPL, version 2. See
# the COPYING file in the top-level directory.
import socket, json, time, commands
from optparse import OptionParser
@miohtama
miohtama / gist:5216738
Created March 21, 2013 21:05
Enabling SSLCACertificateFile and SSLVerifyClient for one page only in Apache 2.2+
# Apache configuration for running local browser against a locally running xxxx for manual smartcard testing
# Listen 4433
<VirtualHost 127.0.0.1:4433>
# Real men use mod_proxy
DocumentRoot "/nowhere"
ServerName local-apache
ServerAdmin [email protected]
@lucasdavila
lucasdavila / 1_ubuntu_terminal_command
Last active August 22, 2024 16:26
Installing Source Code Pro fonts in ubuntu
# to execute this gist, run the line bellow in terminal
\curl -L https://raw.github.com/gist/3875946/install_source_code_pro.sh | sh
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@methane
methane / gist:2185380
Created March 24, 2012 17:28
Tornado Example: Delegating an blocking task to a worker thread pool from an asynchronous request handler
from time import sleep
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
from tornado.web import Application, asynchronous, RequestHandler
from multiprocessing.pool import ThreadPool
_workers = ThreadPool(10)
def run_background(func, callback, args=(), kwds={}):
def _callback(result):
@NicolasT
NicolasT / fiemap.py
Created September 23, 2011 13:59
"fiemap" ioctl bindings for Python
import array
import fcntl
import struct
import collections
# Public API
# From linux/fiemap.h
FIEMAP_FLAG_SYNC = 0x0001
FIEMAP_FLAG_XATTR = 0x0002
FIEMAP_FLAGS_COMPAT = FIEMAP_FLAG_SYNC | FIEMAP_FLAG_XATTR
@fabiant7t
fabiant7t / s3_multipart_upload.py
Created April 17, 2011 14:54
Parallel S3 multipart upload with retries
import logging
import math
import mimetypes
from multiprocessing import Pool
import os
from boto.s3.connection import S3Connection
from filechunkio import FileChunkIO