This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Pixel Art Resizer</title> | |
<style> | |
#input-image { | |
max-width: 100%; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UklGRrBJBgBXQVZFZm10IBAAAAABAAIARKwAABCxAgAEABAAZGF0YXBJBgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
import numpy as np | |
import sys | |
lattice_width = 100 | |
lattice_height = 100 | |
initial_learning_rate = 0.01 | |
input_dimensions = 3 | |
weights = np.random.rand(lattice_height, lattice_width, input_dimensions) | |
initial_neighbourhood_radius = 15.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
"""Splits every line in STDIN using str.split. Prints | |
each field on STDOUT using the indices given as arguments | |
to the script. | |
Usage: | |
echo 'foo bar baz' | pysplit 2 1 0 | |
echo 'foo,bar,baz' | pysplit , 2 1 0 | |
""" | |
import sys |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# ~/.bashrc | |
# | |
# If not running interactively, don't do anything | |
[[ $- != *i* ]] && return | |
# Set directory of current project | |
export CURRENTPROJ=~/Projects | |
cd $CURRENTPROJ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
execute pathogen#infect() | |
"Temporary bindings: | |
nmap <F5> :!love .<CR><CR> | |
"""""""""""" | |
"PLUGINS | |
"""""""""""" | |
"NERDTree | |
nmap \e :NERDTreeToggle<CR> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// returns 1.0 if inside circle | |
float disk(vec2 r, vec2 center, float radius) { | |
return 1.0 - smoothstep( radius-0.005, radius+0.005, length(r-center)); | |
} | |
// returns 1.0 if inside the disk | |
float rectangle(vec2 r, vec2 bottomLeft, vec2 topRight) { | |
float ret; | |
float d = 0.005; | |
ret = smoothstep(bottomLeft.x-d, bottomLeft.x+d, r.x); | |
ret *= smoothstep(bottomLeft.y-d, bottomLeft.y+d, r.y); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// credit: https://www.shadertoy.com/view/4dsGzH | |
vec2 uv = fragCoord.xy / iResolution.xy; | |
vec3 final_color = vec3(1.0); //white | |
vec3 bg_color = vec3(0.0); //black | |
vec3 wave_color = vec3(0.0); //black | |
float wave_width = 0.1; | |
uv = vec2(-1.0, -1.0) + 2.0 * uv; // convert to -1.0 < y < 1.0 | |
uv.y += 0.1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cProfile | |
import collections | |
def pascal(first, length): | |
row = [] | |
a = first | |
for x in range(1, length): | |
# x and y form the ratio between consecutive elements | |
b = length - x | |
a = a * b // x # // is the integer division function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Traceback (most recent call last): | |
File "/usr/lib/python3.4/site-packages/google/protobuf/internal/python_message.py", line 839, in MergeFromString | |
if self._InternalParse(serialized, 0, length) != length: | |
File "/usr/lib/python3.4/site-packages/google/protobuf/internal/python_message.py", line 860, in InternalParse | |
(tag_bytes, new_pos) = local_ReadTag(buffer, pos) | |
File "/usr/lib/python3.4/site-packages/google/protobuf/internal/decoder.py", line 189, in ReadTag | |
while (ord(buffer[pos]) if py2 else buffer[pos]) & 0x80: | |
TypeError: unsupported operand type(s) for &: 'str' and 'int' | |
During handling of the above exception, another exception occurred: |
NewerOlder