Skip to content

Instantly share code, notes, and snippets.

egrep -B10 '\s*nijotz.*(lol|hah)' irc.freenode.#infoforcefeed.weechatlog
@nijotz
nijotz / lolbow.txt
Created June 9, 2016 19:08
LOLBOW winners
[4800x0C:07:19nick@nijotz~/.weechat/logs]$ grep -B1 LOLBOW irc.freenode.#infoforcefeed.weechatlog | grep -Ev '(LOLBOW|--)' | awk '{print $3}' | sort | uniq -c | sort -nr
24 cblgh
17 nijotz
17 jnerula
14 Pilate
12 trinque
11 vhost-
11 uptime
11 ben_vulpes
9 lykkin
@nijotz
nijotz / tensorflow2.py
Created April 3, 2016 21:18
Deep MNIST
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
def weight_variable(shape):
initial = tf.truncated_normal(shape, stddev=0.1)
return tf.Variable(initial)
def bias_variable(shape):
@nijotz
nijotz / tensorflow.py
Last active April 3, 2016 20:43
Handwritten digit analysis
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
# 784 pixels (28 x 28 pixel images), 10 possibile outputs
x = tf.placeholder(tf.float32, [None, 784]) # placeholder
W = tf.Variable(tf.zeros([784, 10])) # weights
b = tf.Variable(tf.zeros([10])) # biases
@nijotz
nijotz / ohjeez.sh
Created January 22, 2016 00:50
IP address from store ID
declare -a ip_address
for i in {3..1}; do
# bash fails when using ${var: -n} to trim strings if the number is greater
# than the number of characters. So this uses ${#var} to test the length
# huehuehue
last_3=${store_id: ${#store_id}<3?0:-3}
if [ $last_3 -gt 255 ]; then
last_3=${last_3: -2}
@nijotz
nijotz / ishappy.py
Created November 21, 2013 21:27
Figure out if a number is happy
# -*- coding: utf-8 -*
def ishappy_recurse(num):
if num == 1:
print "{} is so happy!".format(num)
digits_str = [str(d) for d in str(num)]
digits_int = [int(d) for d in str(num)]
@nijotz
nijotz / solution.sh
Last active September 21, 2015 19:01 — forked from colby/solution.sh
sudo rm -rf /dev/null
@nijotz
nijotz / tabs.vim
Last active September 21, 2015 18:55
Vim tab preference cycle
" Cycle tabbing options
map <leader><tab> :call CycleTabs()<CR>
fun! CycleTabs()
if !&expandtab
echo "4 space tabs"
set shiftwidth=4
set softtabstop=4
set tabstop=4
set expandtab
elseif &expandtab && &shiftwidth == 4
$ awk '{print $1}' ~/.bash_history_all | sort | uniq -c | sort -nr | head -n20
10663 git
3306 rake
1804 middleman
1668 vim
1664 cd
1441 ls
943 cat
672 ruby
594 grep
$ tail -n 20000 * | grep 'dx hugs' | sed -E 's/[[:space:]].*//' | sort | uniq -c | sed -E -e 's/^[[:space:]]*//' | gnuplot -e 'set terminal dumb 120 40; set grid; set datafile separator " "; set xdata time; set timefmt "%Y-%m-%d"; plot "< cat" using 2:1 with lines title ""'
6 ++--+---+----+---+---+---+---+*--+---+---+---+---+---+----+---+---+---+----+---+---+---+---+---+*---+---+---+--++
+ + + * + + + + + * + +
| : : * : : : : : * : |
| : : ** : : : : : * : |
| : : ** : : : : : * : |
| : : ** : : : : : * : |