Skip to content

Instantly share code, notes, and snippets.

import tweepy, json, time, sys
auth = tweepy.OAuth1UserHandler(
<api keys here>
)
api = tweepy.API(auth)
d = json.loads(open(sys.argv[1]).read().split("=", 1)[1])
-- modified version of @jcjohnson's neural-style
-- by @htoyryla 13 Feb 2018
-- allows giving emphasis to nc best channel(s) in each style layer
-- use -style_layers to select layer as usual, using a single layer is recommended
-- -nc to set how many of the best channels are used per layer
-- during target capture, tests the model using the style image
-- and selects nc channels with strongest activations to be given emphasis during iterations
-- not tested with multiple style images
require 'torch'
# git clone from https://github.com/tkarras/progressive_growing_of_gans
# download the snapshot from their Google drive
# use the following code in the same directory to generate random faces
import os
import sys
import time
import glob
import shutil
import operator
import theano
@ttur
ttur / neural-style-instructions.md
Last active November 13, 2017 15:21
Instructions on setting up and running neural-style on CentOS and AWS G2, and how to create slideshow videos of the results with ffmpeg
@peeblesjs
peeblesjs / gist:9288f79322ed3119ece4
Last active February 11, 2016 23:31
A naive "valueForKey:" operator in Swift
operator infix --> {}
func --> (instance: Any, key: String) -> Any? {
let mirror = reflect(instance)
for index in 0 ..< mirror.count {
let (childKey, childMirror) = mirror[index]
if childKey == key {
return childMirror.value
}
}
// my-repl.js
var repl = require("repl");
var replServer = repl.start({
prompt: "my-app > ",
});
replServer.context.foo = "bar";
@webbj74
webbj74 / name.webbj74
Created June 13, 2014 23:21
OSX Packet Filter Rules for using privateinternetaccess.com VPN
#
# OSX packet filter rules
# References:
# * https://gist.github.com/scy/8122924
#
# The purpose of this config is to make sure that my system uses the
# privateInternetAccess VPN connection for everything and not to communicate
# unencrypted when the VPN connection goes down. Therefore, I block
# everything on the physical interfaces except for ICMP, DHCP, DNS and the
@KingOfBrian
KingOfBrian / gist:8d2c6d85cb4079aabde6
Last active January 27, 2016 19:11
Swift Regex matches
import Foundation
operator infix =~ {}
func =~ (input: String, pattern: String) -> String[]? {
let regex = NSRegularExpression(pattern: pattern, options: .CaseInsensitive, error: nil)
let results = regex.matchesInString(input,
options: nil,
range: NSMakeRange(0, countElements(input))
@aras-p
aras-p / preprocessor_fun.h
Last active April 28, 2024 15:25
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
"""
combine.py
alternate between two audiofiles, beat by beat
By Paul Lamere, 2013-01-25
"""
import echonest.audio as audio
usage = """