Skip to content

Instantly share code, notes, and snippets.

View theredcat's full-sized avatar

Nathan Delhaye theredcat

  • Interencheres
  • Paris, France
View GitHub Profile
# C-b is not acceptable -- Vim uses it
set-option -g prefix C-a
bind-key C-a last-window
# Start numbering at 1
set -g base-index 1
vec2 hash_2d(vec2 v)
{
float angle = 3.14/8.0; // 22.5° clockwise
// Do rotation clockwise
mat2 m = mat2(cos(angle), -1.0 * sin(angle), sin(angle), cos(angle));
vec2 P = vec2(
(m[0][0]*v.x) + (m[1][0]*v.y),
(m[0][1]*v.x) + (m[1][1]*v.y)
);
P.x = fract(cos(P.x)*221.2);
extends Resource
class_name WorleyNoise
func hash_2d(v):
var angle = PI/8.0 # 22.5° clockwise
# Do rotation clockwise
var m = [
[cos(angle), -1 * sin(angle)],
[sin(angle), cos(angle)]
]
@theredcat
theredcat / gist:604994e612df7e77f323bb502809bc49
Last active October 17, 2016 15:27
Add veth to LXC container
function lxcaddveth() {
local pid=$(lxc-info -n ${1} -p | awk '{print $2}')
mkdir -p /var/run/netns
ln -sf /proc/$pid/ns/net "/var/run/netns/${1}"
ip link add name veth${2} type veth peer name veth${2}_c
ip link set dev veth${2}_c netns ${1} name ${3}
lxc-attach -n ${1} /sbin/ifconfig ${3} up