Skip to content

Instantly share code, notes, and snippets.

@EvanKrall
EvanKrall / counter.html
Created February 20, 2011 01:09
Shows the number of characters remaining in a textarea.
<html>
<head>
<style>
.empty {
color: green;
}
.almostfull {
color: yellow;
}
.full {
@EvanKrall
EvanKrall / buttons.html
Created March 1, 2011 08:20
Closures and for loops.
<html>
<head>
<style>
span {
border: 1px solid black;
border-radius: 6px;
padding: 3px;
margin: 2px;
background: #dde;
-webkit-box-shadow: 3px 3px 6px rgba(0,0,0,0.5);
@EvanKrall
EvanKrall / histogram.sh
Created April 22, 2011 05:33
Given a list of numbers separated by newlines, prints out a histogram.
#!/bin/bash
NUMTESTS=0
histogram=()
while read num
do
((NUMTESTS++))
((histogram[num]++))
done
@EvanKrall
EvanKrall / delete_regex_blank_line.sh
Created September 29, 2011 23:07
Delete a regexp and optionally a blank line after it.
#!/bin/bash
regex="$1"
filename="$2"
sed --separate --in-place "/^${regex}\$/,+1{
/^${regex}\$/d
/^\$/d
}" "$filename"
function timeit() (
command=("$@")
exec 3>&1
exec 4>&2
time_output=$( ( TIMEFORMAT="%3R"; time "${command[@]}" 1>&3 2>&4; ) 2>&1 )
echo "time output: $time_output"
)
#include <stdio.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/mount.h>
#include <stdlib.h>
int main(int argc, char **argv) {
mkdir("/mnt/aufs", 0755);
mkdir("/tmp/br1", 0755);
mkdir("/tmp/br2", 0755);
root@a7c3804e9aa4:/# ldd /usr/local/lib/python2.7/site-packages/mesos/executor/_executor.so
linux-vdso.so.1 => (0x00007ffc351ba000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fd3ed9cd000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fd3ed7c5000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fd3ed4c0000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fd3ed1ba000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fd3ecfa4000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fd3ecd85000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fd3ec9c0000)
/lib64/ld-linux-x86-64.so.2 (0x0000555664a7e000)
@EvanKrall
EvanKrall / keybase.md
Created November 18, 2016 01:43
keybase/github identity proof

Keybase proof

I hereby claim:

  • I am EvanKrall on github.
  • I am evankrall (https://keybase.io/evankrall) on keybase.
  • I have a public key whose fingerprint is 50E7 67BC 4DE7 C49A 2B8D 5812 F030 BBF3 29C6 54FD

To claim this, I am signing this object:

<?xml version='1.0' encoding='utf-8'?>
<?grc format='1' created='3.7.9'?>
<flow_graph>
<timestamp>Sun Feb 19 15:32:55 2017</timestamp>
<block>
<key>options</key>
<param>
<key>author</key>
<value></value>
</param>
Python 3.6.0 (default, Jan 13 2017, 20:56:47)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
>>> import tensorflow_probability as tfp
>>> dist1 = tfp.distributions.Beta(tf.ones([1]), tf.ones([1]))
>>> dist2 = tfp.distributions.TransformedDistribution(distribution=dist1, bijector=tfp.bijectors.Affine(shift=tf.ones([1])))
>>> dist2.log_prob(tf.zeros([1]))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>