Skip to content

Instantly share code, notes, and snippets.

View karlosgliberal's full-sized avatar

karlos g liberal karlosgliberal

View GitHub Profile

Twitter abuses all media file uploads, each type in its own way. If we want to upload a good looking animation loop from some low-color, high-detail generative art, we have to game their system's mechanisms.

  • don't upload a video file, they will re-encode it into absolute 💩

  • create a GIF, which they will auto-convert into a video file 😱

  • The frames of the GIF will be resized to an even-sized width using an extremely naive algorithm. Your GIF should be an even size (1000, 2000,

@Quasimondo
Quasimondo / hic_et_nunc_get_all_token_data.py
Created April 2, 2021 12:03
Some basic code to retrieve hic et nunc token data from better-call.dev
import os
import pickle
import requests
#download cached token data here:
#https://drive.google.com/file/d/1g_4w_Re5Y0NmcS2Y55WQzESWDeL2dey6/view?usp=sharing
#and put it into the same folder as this file
cachedTokenData = {"maxTokenID":-1,"knownTokenIds":{},"data":[]}
if os.path.exists("cached_token_data.pickle"):
@mattdesl
mattdesl / ComplexSketch.svelte
Last active October 3, 2021 21:32
svelte musings
<script>
import delaunay from 'delaunay-triangulate';
import { Slider, Color } from 'texel/ui';
// This will get passed in with the P5 instance
export let p5;
// Size of the canvas in pixels
export let width = 256;
export let height = 256;
#!/usr/bin/env python3
from PIL import Image
import numpy as np
import tensorflow as tf
import tensorflow_hub as hub
# smooth values from point a to point b.
STEPS = 100
pt_a = np.random.normal(size=(512))
# 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
from gensim.models import KeyedVectors
# Load gensim word2vec
w2v_path = '<Gensim File Path>'
w2v = KeyedVectors.load_word2vec_format(w2v_path)
import io
# Vector file, `\t` seperated the vectors and `\n` seperate the words
"""
@enjalot
enjalot / ndjson.md
Last active December 15, 2021 04:10
Tips for processing Quick, Draw! data with ndjson-cli

Quick, Draw! ndjson data

The Quick, Draw! dataset uses ndjson as one of the formats to store its millions of drawings.

We can use the ndjons-cli utility to quickly create interesting subsets of this dataset.

The drawings (stroke data and associated metadata) are stored as one JSON object per line. e.g.:

{
@jkuip
jkuip / iot.txt
Created February 14, 2017 11:58
Data Visualization using Particle, Firebase and P5js: https://www.youtube.com/watch?v=puBpA1LmGCs
///////////////////////////////////
// PARTICLE / WIRING CODE //
///////////////////////////////////
int photoResistor = A0;
int power = A5;
int lightValue;
void setup() {
pinMode(photoResistor,INPUT);
@kylemcdonald
kylemcdonald / download-urls.py
Last active June 6, 2023 23:47
Download a range of URLs in parallel.
from multiprocessing.dummy import Pool
from tqdm import tqdm
from urllib.parse import urlsplit
import urllib3
import itertools, functools, operator
import os
import sys
import re
import errno
import argparse
@genekogan
genekogan / _Instructions.md
Last active September 21, 2024 10:33
instructions for generating a style transfer animation from a video

Instructions for making a Neural-Style movie

The following instructions are for creating your own animations using the style transfer technique described by Gatys, Ecker, and Bethge, and implemented by Justin Johnson. To see an example of such an animation, see this video of Alice in Wonderland re-styled by 17 paintings.

Setting up the environment

The easiest way to set up the environment is to simply load Samim's a pre-built Terminal.com snap or use another cloud service like Amazon EC2. Unfortunately the g2.2xlarge GPU instances cost $0.99 per hour, and depending on parameters selected, it may take 10-15 minutes to produce a 512px-wide image, so it can cost $2-3 to generate 1 sec of video at 12fps.

If you do load the