Skip to content

Instantly share code, notes, and snippets.

@dreikanter
dreikanter / encrypt_openssl.md
Last active May 8, 2025 22:17 — forked from crazybyte/encrypt_openssl.txt
File encryption using OpenSSL

Symmetic encryption

For symmetic encryption, you can use the following:

To encrypt:

openssl aes-256-cbc -salt -a -e -in plaintext.txt -out encrypted.txt

To decrypt:

@lilydjwg
lilydjwg / mynetns_run
Created May 13, 2016 14:27
mynetns_run: Run a program in a seperate network namespace
#!/bin/bash -e
NETNS_FILE=/var/run/netns/mynet
MNTNS_FILE=/var/run/ns/mynet_mnt
if [[ ! -f $NETNS_FILE ]]; then
ip netns add mynet
ip link add mynet0 type veth peer name mynet1
ip link set mynet0 up
@martior
martior / gist:ee2a1ed3e7522103f33cf13a4570456e
Created April 29, 2016 21:13
Convert Trac WikiFormating to markdown
#!/usr/bin/python
# based on: https://gist.github.com/sgk/1286682
text = """
"""
import datetime
import re
@fijimunkii
fijimunkii / git checkout remote master to local branch
Created March 7, 2016 15:08
git checkout remote master to local branch
git fetch <remote> <rbranch>:<lbranch>
git checkout <lbranch>
@pommi
pommi / trac2down.py
Last active October 9, 2019 00:55 — forked from sgk/trac2down.py
Trac Wiki to Markdown converter
#!/usr/bin/python
# vim:set fileencoding=utf-8 sw=2 ai:
# downloaded from https://gist.github.com/tcchau/4628317
# ... which is a fork from https://gist.github.com/sgk/1286682
import sqlite3
import datetime
import re
# additional imports --ah
@cirocosta
cirocosta / hash-table.c
Last active January 31, 2024 14:02
glibc hash table example
/**
* Compile with -D_GNU_SOURCE
* Note: we're using static keys here and we don't plan to add
* new items to the table. In such case using a perfect
* hash generator (e.g, gperf) would clearly outperform
* this simple example w/ the cost of first running gperf
* (and other tradeoff that must be considered)
*
* Note: it's up to you to manage those resources contained in
* the hash table. Also, hsearch does NOT provide a
@mrtns
mrtns / gist:78d15e3263b2f6a231fe
Last active January 19, 2025 08:02
Upgrade Chrome from Command Line on Ubuntu
# Install
# via http://askubuntu.com/questions/510056/how-to-install-google-chrome
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
sudo apt-get update
sudo apt-get install google-chrome-stable
# Update
@willjasen
willjasen / ubuntu-graylog2.sh
Last active May 29, 2016 01:21
Graylog2 on Ubuntu
## Sets up Graylog2 on Ubuntu
# Variables
ELASTICACHE_VERSION=0.90.10
GRAYLOG2_VERSION=0.20.6
GRAYLOG2_WEB_VERSION=0.20.6
GRAYLOG2_PORT=12900
GRAYLOG2_WEB_PORT=9000
PASSWORD=password
#!/bin/bash
# usage ./notify.sh [path to folder] [command line to execute on change]
while true
do
set -e
inotifywait -q -r --exclude ".git|.idea" -e close_write,moved_to,create $1 > /dev/null
set +e
eval ${*:2}
@awakekat
awakekat / Gulp Jade Example
Created December 18, 2014 03:42
Example of Gulp Jade
//From http://stackoverflow.com/questions/25384796/can-i-set-gulp-livereload-to-run-after-all-files-are-compiled
var gulp = require('gulp');
var jade = require('gulp-jade');
var gutil = require('gulp-util');
var stylus = require('gulp-stylus');
var jeet = require('jeet');
var nib = require('nib');
var uglify = require('gulp-uglify');
var livereload = require('gulp-livereload');