26.11.2015, ttur@futurice.com
See https://github.com/jcjohnson/neural-style for information on what is neural-style
See www.spiceprogram.org/artcorn to see what I've done with it
See this file for the related commands and installation procedures
| import argparse | |
| import json | |
| import logging | |
| import os | |
| import re | |
| import shutil | |
| from concurrent.futures import ProcessPoolExecutor, as_completed | |
| from dataclasses import dataclass | |
| from datetime import datetime | |
| from typing import Any, Callable, Dict, List, Literal, Optional, Tuple |
| 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 |
26.11.2015, ttur@futurice.com
See https://github.com/jcjohnson/neural-style for information on what is neural-style
See www.spiceprogram.org/artcorn to see what I've done with it
See this file for the related commands and installation procedures
| 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"; |
| # | |
| # 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 |
| 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)) |
| // 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, |