Skip to content

Instantly share code, notes, and snippets.

@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
@nijotz
nijotz / solution.sh
Last active September 21, 2015 19:01 — forked from colby/solution.sh
sudo rm -rf /dev/null
@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 / 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 / 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 / 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 / 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
egrep -B10 '\s*nijotz.*(lol|hah)' irc.freenode.#infoforcefeed.weechatlog
@nijotz
nijotz / DiscoStrobe.ino
Created August 13, 2016 06:03 — forked from kriegsman/DiscoStrobe.ino
DiscoStrobe - Flashing rainbow lights that zoom back and forth to a beat
#include "FastLED.h"
// DiscoStrobe
// *Flashing* rainbow lights that zoom back and forth to a beat.
// See your doctor before using this code if you have certain neurological conditions.
//
// Mark Kriegsman, July 2015
#if FASTLED_VERSION < 3001000
python: stdout/stderr (slack): Traceback (most recent call last):
python: stdout/stderr (slack): File "/home/nick/.weechat/python/wee_slack.py", line 133, in wrapper
python: stdout/stderr (slack): return f(data, current_buffer, *args, **kwargs)
python: stdout/stderr (slack): File "/home/nick/.weechat/python/wee_slack.py", line 144, in wrapper
python: stdout/stderr (slack): return f(*decode_from_utf8(args), **decode_from_utf8(kwargs))
python: stdout/stderr (slack): File "/home/nick/.weechat/python/wee_slack.py", line 3868, in command_thread
python: stdout/stderr (slack): msg = get_msg_from_id(channel, args)
python: stdout/stderr (slack): File "/home/nick/.weechat/python/wee_slack.py", line 3854, in get_msg_from_id
python: stdout/stderr (slack): return channel.hashed_messages.get(msg_id)
python: stdout/stderr (slack): AttributeError: 'SlackTeam' object has no attribute 'hashed_messages'