Skip to content

Instantly share code, notes, and snippets.

View Radagaisus's full-sized avatar

Almog Melamed Radagaisus

View GitHub Profile
@DanHulton
DanHulton / gist:993415
Created May 26, 2011 15:58 — forked from hashmal/gist:803816
Playing with CoffeeScript, do funny things with mixins.
# Swappable Mixins in CoffeeScript
# ================================
# Many thanks to Hashmal, who wrote this to start.
# https://gist.github.com/803816/aceed8fc57188c3a19ce2eccdb25acb64f2be94e
# Usage
# -----
# class Derp extends Mixin
@heuristicfencepost
heuristicfencepost / geb1.pl
Created July 10, 2012 06:49
GEB MIU system in various languages
# Simple implementation of the productions for the MIU system
open INFILE,"<",$ARGV[0];
while(<INFILE>) {
chomp;
next if $_ =~ /#.*/;
print "$1IU\n" if $_ =~ /^(.+?)I$/;
print "M$1$1\n" if $_ =~ /^M(.+)$/;
print "$1U$2\n" if $_ =~ /^(.*)III(.*)$/;
print "$1$2\n" if $_ =~ /^(.*)UU(.*)$/;
@hvr
hvr / gist:662196
Created November 4, 2010 07:02
Show key fingerprints of public keys in .ssh/authorized_keys file
#!/bin/bash
( while read L
do echo $L > /tmp/pubkey
printf "%-16s => " $(cut -f 3 -d ' ' /tmp/pubkey)
ssh-keygen -l -f /tmp/pubkey
done
rm /tmp/pubkey
) < .ssh/authorized_keys
@czottmann
czottmann / example.js
Created April 16, 2012 13:28
Underscore.template: Super-simple/-stupid partials. It's quick and dirty yet it does what I want, so there.
// Fetch the template HTML from the DOM, hand it over to `Underscore.template`,
// assign some variables, and set up a `partial` method.
var template = $("#tmpl-main-section").html(),
compiledTemplate = _.template( template, {
models: aCollectionOfThings,
// See template examples below on usage. It's all very complex.
partial: function( partialName, variables ) {
return _.template(
$( "#tmpl-" + partialName ).html(),
@mrdrozdov
mrdrozdov / example.py
Last active December 28, 2018 22:10
Logging in Tensorflow
from tf_logger import TFLogger
""" Example of using TFLogger to save train & dev statistics. To visualize
in tensorboard simply do:
tensorboard --logdir /path/to/summaries
This code does depend on Tensorflow, but does not require that your model
is built using Tensorflow. For instance, could build a model in Chainer, then
@slode
slode / numpy-fast-symmetric-pad.py
Last active June 11, 2020 03:39
A faster numpy pad algorithm where the padding mode is symmetric along the axes.
"""
MIT License
Copyright (c) 2017 Stian Lode,
stian.lode@gmail.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@igrigorik
igrigorik / json-bq-schema-generator.rb
Last active November 3, 2022 17:34
BigQuery JSON schema generator
require 'open-uri'
require 'zlib'
require 'yajl'
# References
# - https://developers.google.com/bigquery/preparing-data-for-bigquery#dataformats
# - https://developers.google.com/bigquery/docs/data#nested
#
def type(t)
@jimbojsb
jimbojsb / gist:1630790
Created January 18, 2012 03:52
Code highlighting for Keynote presentations

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2: