Skip to content

Instantly share code, notes, and snippets.

View rjzak's full-sized avatar

Richard Zak rjzak

View GitHub Profile
achimnol / cuda.conf
Last active September 25, 2016 15:32
An upstart configuration for NVIDIA CUDA device initialization without X environments (derived from Sangjin Han's init.d script)
description "CUDA initialization without X environments"
start on runlevel [2345]
stop on runlevel [!2345]
pre-start script
[ -x "$HOLD_GPU" ] || { echo "$HOLD_GPU is missing or not executable!"; exit 1; }
lost-theory /
Created January 12, 2013 23:49
flask: show request time in template
import time
from flask import Flask, request, g, render_template
app = Flask(__name__)
app.config['DEBUG'] = True
def before_request():
g.request_start_time = time.time()
willurd /
Last active May 21, 2024 09:23
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
michaljemala / tls-client.go
Last active April 10, 2024 01:57
SSL Client Authentication Golang sample
package main
import (
byobu keybindings can be user defined in /usr/share/byobu/keybindings/ (or within .screenrc if byobu-export was used). The common key bindings
F2 - Create a new window
F3 - Move to previous window
F4 - Move to next window
ramhiser /
Last active April 7, 2021 06:44
Apply one-hot encoding to a pandas DataFrame
import pandas as pd
import numpy as np
from sklearn.feature_extraction import DictVectorizer
def encode_onehot(df, cols):
One-hot encoding is applied to columns specified in a pandas DataFrame.
Modified from:
stevenvo /
Last active March 16, 2021 08:23
Sort array by nth column in Numpy
# sort array with regards to nth column
arr = arr[arr[:,n].argsort()]
Shaltz / gist:1d65a07a0901a36fb7f1
Created September 16, 2015 09:02
HOW TO fix openLDAP checksum error on config files
(source :
How to fix “ldif_read_file: checksum error”
Posted on October 28, 2014
Well, in spite of you did read a banner saying “# AUTO-GENERATED FILE – DO NOT EDIT!! Use ldapmodify.” you ignored it and made some manual modifications in any of the LDIF files in /etc/ldap/slapd.d/.
Don’t worry it happened to me too :) When you need to quickly setup an openLDAP server for development it is pretty much easier to tweak these files although the recommended way is to use ldapmodify tool. But if you change the LDIF files in cn=config manually, their contents and checksums won’t match, which is not fatal, but is annoying when using tools such as slapcat:
Byobu is a suite of enhancements to tmux, as a command line
tool providing live system status, dynamic window management,
and some convenient keybindings:
F1 * Used by X11 *
Shift-F1 Display this help
F2 Create a new window
Shift-F2 Create a horizontal split
Ctrl-F2 Create a vertical split
Ctrl-Shift-F2 Create a new session