Skip to content

Instantly share code, notes, and snippets.

Avatar

Almog Melamed Radagaisus

View GitHub Profile
@slode
slode / numpy-fast-symmetric-pad.py
Last active Jun 11, 2020
A faster numpy pad algorithm where the padding mode is symmetric along the axes.
View numpy-fast-symmetric-pad.py
"""
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
@mrdrozdov
mrdrozdov / example.py
Last active Dec 28, 2018
Logging in Tensorflow
View example.py
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
@igrigorik
igrigorik / json-bq-schema-generator.rb
Last active Nov 3, 2022
BigQuery JSON schema generator
View json-bq-schema-generator.rb
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)
@heuristicfencepost
heuristicfencepost / geb1.pl
Created Jul 10, 2012
GEB MIU system in various languages
View geb1.pl
# 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(.*)$/;
@czottmann
czottmann / example.js
Created Apr 16, 2012
Underscore.template: Super-simple/-stupid partials. It's quick and dirty yet it does what I want, so there.
View example.js
// 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(),
@jimbojsb
jimbojsb / gist:1630790
Created Jan 18, 2012
Code highlighting for Keynote presentations
View gist:1630790

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:

@DanHulton
DanHulton / gist:993415
Created May 26, 2011 — forked from hashmal/gist:803816
Playing with CoffeeScript, do funny things with mixins.
View gist:993415
# Swappable Mixins in CoffeeScript
# ================================
# Many thanks to Hashmal, who wrote this to start.
# https://gist.github.com/803816/aceed8fc57188c3a19ce2eccdb25acb64f2be94e
# Usage
# -----
# class Derp extends Mixin
@hvr
hvr / gist:662196
Created Nov 4, 2010
Show key fingerprints of public keys in .ssh/authorized_keys file
View gist:662196
#!/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