Skip to content

Instantly share code, notes, and snippets.

Avatar

Starbeamrainbowlabs sbrl

View GitHub Profile
@ppope
ppope / preprocess_twitter.py
Last active May 13, 2021 — forked from tokestermw/preprocess-twitter.py
FORK: Python version of Ruby script to preprocess tweets for use in GloVe featurization http://nlp.stanford.edu/projects/glove/.
View preprocess_twitter.py
"""
preprocess-twitter.py
python preprocess-twitter.py "Some random text with #hashtags, @mentions and http://t.co/kdjfkdjf (links). :)"
Script for preprocessing tweets by Romain Paulus
with small modifications by Jeffrey Pennington
with translation to Python by Motoki Wu
Translation of Ruby script to create features for GloVe vectors for Twitter data.
@orangeblock
orangeblock / handler.sh
Last active Mar 22, 2020
GitHub webhook listener, using netcat and bash. `listen.sh` and `handler.sh` must be in the same directory. Start with `./listen.sh <port> <path-to-script> [<endpoint>]`. All files (including scripts) must be executable.
View handler.sh
#!/bin/bash
# parse endpoint (only works for POST)
read request
url="${request#POST }"
url="${url% HTTP/*}"
# change this!!!
secret="top-secret"
View Procjam-WFC-tutorial.md

Generating Procedural Game Worlds with Wave Function Collapse

Wave Function Collapse (WFC) by @exutumno is a new algorithm that can generate procedural patterns from a sample image. It's especially exciting for game designers, letting us draw our ideas instead of hand coding them. We'll take a look at the kinds of output WFC can produce and the meaning of the algorithm's parameters. Then we'll walk through setting up WFC in javascript and the Unity game engine.

sprites

The traditional approach to this sort of output is to hand code algorithms that generate features, and combine them to alter your game map. For example you could sprinkle some trees at random coordinates, draw roads with a brownian motion, and add rooms with a Binary Space Partition. This is powerful but time consuming, and your original vision can someti

@egmontkob
egmontkob / Hyperlinks_in_Terminal_Emulators.md
Last active Jul 19, 2022
Hyperlinks in Terminal Emulators
View Hyperlinks_in_Terminal_Emulators.md
@need12648430
need12648430 / lcg.js
Last active Aug 29, 2015
Linear congruential generator (Seedable PRNG) with weighted choices and shuffling in 1.4kb of clean JS.
View lcg.js
var LCG = (function () {
var c = 0x93456789, a = 0x169659, mod, mask, r;
mask = (mod = Math.pow(2, 31)) - 1;
function LCG(seed) {
this.seed = seed || new Date().getTime();
}
LCG.prototype = {
nextInt:
@tokestermw
tokestermw / preprocess-twitter.py
Last active May 12, 2021
Python version of Ruby script to preprocess tweets for use in GloVe featurization http://nlp.stanford.edu/projects/glove/
View preprocess-twitter.py
"""
preprocess-twitter.py
python preprocess-twitter.py "Some random text with #hashtags, @mentions and http://t.co/kdjfkdjf (links). :)"
Script for preprocessing tweets by Romain Paulus
with small modifications by Jeffrey Pennington
with translation to Python by Motoki Wu
Translation of Ruby script to create features for GloVe vectors for Twitter data.
View OneEightyT.js
/* An HTML template in 180 bytes (minified)
Features: Escapes HTML, accepts either strings or functions as values, and that's all (it doesn't handle looping).
Usage:
OneEightyT(
"<h1>{name}</h1><div>{content} @ {currentTime}</div>",
{
name: "Stella",
View IdleBlur.js
javascript:(function(){
var delay=60000, delay2=1000, intensity=0.0, timer, timer2, i=0;
function reset(){document.documentElement.setAttribute('style',''); clearTimeout(timer); clearTimeout(timer2); intensity = 0.0; i = 0; timer = setTimeout(blur, delay);}
function blur(){
if(intensity<6){
intensity+=0.5;
applyBlur(intensity);
timer2 = setTimeout(blur, delay2);
}
}
@myusuf3
myusuf3 / delete_git_submodule.md
Created Nov 3, 2014
How effectively delete a git submodule.
View delete_git_submodule.md

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@9point6
9point6 / ssh-retry.sh
Last active Jul 26, 2022
Keep retrying SSH connection until success (Useful for waiting for VMs to boot)
View ssh-retry.sh
#!/usr/bin/env bash
# Check we've got command line arguments
if [ -z "$*" ] ; then
echo "Need to specify ssh options"
exit 1
fi
# Start trying and retrying
((count = 100))