Skip to content

Instantly share code, notes, and snippets.

View awentzonline's full-sized avatar

Adam Wentz awentzonline

View GitHub Profile
@awentzonline
awentzonline / git-marge
Created June 25, 2014 22:27
git-marge: make it executable and put it on your PATH somewhere (make sure it's named git-marge)
echo "DOH!"
<!DOCTYPE html>
<html>
<head>
<title>Blink</title>
<style type="text/css">
blink {
display: block;
}
.nav > blink {
display: inline-block;
import re
re_normalize = re.compile('[\W]+')
def normalize_anagram(a):
a = a.lower()
a = re_normalize.sub('', a)
a = ''.join(sorted(a))
<!doctype HTML>
<html>
<head>
<title>asdf</title>
</head>
<body>
<object width="356" height="600" type="application/x-shockwave-flash">
<param name="allowScriptAccess" value="always" />
<param name="allownetworking" value="all" />
<param name="allowfullscreen" value="true" />
function bleed(selector) {
$(selector).each(function (i, el) {
var elImg = $(el);
var offset = elImg.offset();
var bimg = $('<img>');
bimg.attr(
'src',
'http://rs201.pbsrc.com/albums/aa137/angelsuejones23/f_ed80a26488.gif~c200'
);
bimg.css({
$('img').each(function (i, el) {
var elImg = $(el);
var offset = elImg.offset();
var bimg = $('<img>');
bimg.attr(
'src',
'http://rs201.pbsrc.com/albums/aa137/angelsuejones23/f_ed80a26488.gif~c200'
);
bimg.css({
position: 'absolute',
# -*- coding: utf-8 -*-
# Copyright (C) 2012, Almar Klein, Ant1, Marius van Voorden
#
# This code is subject to the (new) BSD license:
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
@awentzonline
awentzonline / youtube-gif-looper.py
Created February 13, 2015 20:25
Finds looping sections of youtube videos and makes gifs.
import moviepy.editor as mpy
from moviepy.video.tools.cuts import FramesMatches
def youtube2gif(youtube_id, t_start=None, t_end=None):
# Get the video from youtube
download_filename = "{}.mp4".format(youtube_id)
mpy.download_webfile(youtube_id, download_filename)
clip = mpy.VideoFileClip(download_filename).resize(width=200)
'''Keep the convolutional network weights only.'''
import sys
import h5py
if __name__ == '__main__':
in_filename, out_filename = sys.argv[-2:]
print('Stripping {} into {}'.format(in_filename, out_filename))
in_f = h5py.File(in_filename, 'r')
import sys
import numpy as np
import six
# HACK: this should live in a directory alongside the skip-thoughts project
sys.path.append('../skip-thoughts')
import skipthoughts
import decoding.tools