Skip to content

Instantly share code, notes, and snippets.

Avatar
🐠
Fishing.

Juan M Uys opyate

🐠
Fishing.
View GitHub Profile
@opyate
opyate / README.md
Last active May 14, 2021
Simple no-cache Python 3 webserver
View README.md

Simple no-cache Python 3 webserver which runs on port 8000.

Run with

./webserver.py
@opyate
opyate / singleton.gd
Last active May 8, 2021
Global music for a Godot game, with fade-in if the song is made for looping (i.e. starts of loudly)
View singleton.gd
extends Node
func _ready():
var fade_in = Tween.new()
add_child(fade_in)
var music = AudioStreamPlayer.new()
add_child(music)
var stream = load("res://assets/audio/music/song.ogg")
music.set_stream(stream)
music.pitch_scale = 1
View README.md

This is a combination of

  • stapler
  • scissors
  • knocking on a window (reversed)
  • wobbling an A4 sheet of thin cardboard
  • sticky tape coming unstuck (with reverb)

Made with Audacity.

@opyate
opyate / change_git_submodule.md
Last active Mar 10, 2020
Change a git submodule remote
View change_git_submodule.md

To change a git submodule's remote (in this case, from HTTPS to SSH):

SUB=my-submodule-name
$REMOTE=git@gitlab.com:path/to/remote.git

git submodule deinit $SUB
git rm $SUB
git commit -m "removed $SUB submodule at https remote"
rm -rf .git/modules/$SUB
View env.yml
name: synth36
channels:
- conda-forge
- defaults
dependencies:
- backports
- backports.functools_lru_cache
- blas
- bzip2
- ca-certificates
@opyate
opyate / snippets.py
Last active Nov 24, 2017
deeplearning.ai week 2 code snippets
View snippets.py
import numpy as np
# Activation functions
sigmoid = lambda x: 1 / (1 + np.exp(-x))
# tanh is just np.tanh
relu = lambda x: np.maximum(0, x)
leaky_relu = lambda x: np.maximum(0.001*x, x)
def sigmoid_derivative(x):
s = sigmoid(x)
@opyate
opyate / commit-msg
Created Oct 10, 2017
JIRA code commit msg hook; presumes merges happen on remote (via PR mechanism, etc)
View commit-msg
#!/bin/sh
# .git/hooks/commit-msg
test "" != "$(egrep '[A-Z]{3,}-\d+' "$1")" || {
echo >&2 Commit message requires JIRA code.
exit 1
}
@opyate
opyate / Makefile
Created Sep 9, 2017
Quickly create a new Jekyll site, preview it, and publish it to your chosen cloud.
View Makefile
.PHONY: new pub run
new:
docker run --rm --label=jekyll --volume=$(shell pwd):/srv/jekyll -it -p 127.0.0.1:80:80 jekyll/jekyll:3.5.2 jekyll new thenewshiny
run:
docker run --rm --label=jekyll --volume=$(shell pwd)/thenewshiny:/srv/jekyll -it -p 127.0.0.1:80:4000 jekyll/jekyll:3.5.2 jekyll serve
_pub:
gsutil defacl ch -u AllUsers:R gs://my.website
View keybase.md

Keybase proof

I hereby claim:

  • I am opyate on github.
  • I am uys (https://keybase.io/uys) on keybase.
  • I have a public key whose fingerprint is A1D6 F8E9 BD50 3556 1583 44A4 4F35 6D93 9D11 EBF2

To claim this, I am signing this object: