Skip to content

Instantly share code, notes, and snippets.

View godspeed1989's full-sized avatar
🎯
Focusing

godspeed1989 godspeed1989

🎯
Focusing
View GitHub Profile
@jamis
jamis / wilsons.rb
Created December 31, 2010 04:06
An implementation of Wilson's algorithm for generating mazes.
# --------------------------------------------------------------------
# An implementation of Wilson's algorithm for generating mazes.
# Slightly smarter than Aldous-Broder, it is novel in its use of a
# "scout" to build each path before actually recording it. Like
# Aldous-Broder, though, it is not guaranteed to ever finish, if
# the RNG makes poor choices.
#
# As with Aldous-Broder, watching the animation of its progress can
# be an exercise in frustration as you find yourself urging the cursor
# to JUST GO OVER THERE! Try it and see for yourself. :)
@jamis
jamis / growing-tree.rb
Created December 31, 2010 05:23
An implementation of the "Growing Tree" algorithm for maze generation.
# --------------------------------------------------------------------
# An implementation of the "Growing Tree" algorithm. This one is
# notable for it's ability to become nearly identical to Prim's
# algorithm, or the Recursive Backtracking algorithm, depending on
# how the cells are removed from the list that aggregates as the
# algorithm runs.
#
# This script allows you to play with those settings by specifying
# the mode after the width and height parameters, as "random" (pull
# the cell from list at random), "newest" (pull the newest cell),
pushd /usr/src/linux
CF="-march=native -mtune=native -O3"
MF='V=2 ARCH=x86_64 --jobs=10 --load-average=6.0'
mount /boot;
make ${MF} CFLAGS="${CF}" modules_prepare || exit 255;
make ${MF} CFLAGS="${CF}" vmlinux || exit 255;
make ${MF} CFLAGS="${CF}" modules || exit 255;
make ${MF} CFLAGS="${CF}" bzImage || exit 255;
make ${MF} CFLAGS="${CF}" modules_install || exit 255;
@jcrubino
jcrubino / gist:3342577
Created August 13, 2012 17:18 — forked from greeness/gist:1420935
tutorial ml codes
/*
* linux 2.6.37-3.x.x x86_64, ~100 LOC
* gcc-4.6 -O2 semtex.c && ./a.out
* 2010 [email protected], salut!
*
* update may 2013:
* seems like centos 2.6.32 backported the perf bug, lol.
* jewgold to 115T6jzGrVMgQ2Nt1Wnua7Ch1EuL9WXT2g if you insist.
*/
@bojieli
bojieli / kprobe.c
Created April 28, 2014 14:29
detect link up/down and its initiator with kprobe
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/kprobes.h>
#include <linux/netdevice.h>
#include <linux/fs.h>
#include <linux/fs_struct.h>
/* For each probe you need to allocate a kprobe structure */
static struct kprobe kp = {
.symbol_name = "dev_change_flags",
@akors
akors / conv3dnet.py
Created August 10, 2016 10:15
Example of 3D convolutional network with TensorFlow
import tensorflow as tf
import numpy as np
FC_SIZE = 1024
DTYPE = tf.float32
def _weight_variable(name, shape):
return tf.get_variable(name, shape, DTYPE, tf.truncated_normal_initializer(stddev=0.1))