Skip to content

Instantly share code, notes, and snippets.

View louis030195's full-sized avatar

louis030195 louis030195

View GitHub Profile
@surprisetalk
surprisetalk / hn-gpt-free.js
Created March 23, 2023 13:00
Userscript to hide any HackerNews story with "GPT" in its title.
// ==UserScript==
// @name HackerNews GPT-Free Feed
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Hides any Hacker News story with "GPT" in its title.
// @author Taylor Troesh
// @include https://news.ycombinator.com/*
// @grant none
// ==/UserScript==
@nythrox
nythrox / do.ts
Last active May 5, 2022 19:17
Typescript do notation (using generator functions)
// user: Either<string, { name: string, age: number }>
const user = doEither(function*() {
// name: string
const name = yield* Right("test")
// age: number
const age = Math.random() > 0.5 ? yield* Right(100) : yield* Left("oopsies")
return {
name,
age
}
@louis030195
louis030195 / Value.cs
Last active October 7, 2020 19:02
Automatic differentiation in 3 languages
using System;
using System.Collections.Generic;
using System.Linq;
public class Value
{
public double Data { get; set; }
public double Gradient { get; set; }
private Action _backward;
private readonly List<Value> _prev;
@louis030195
louis030195 / visual-vxlan.md
Last active October 24, 2020 16:35
How VxLAN works

edit at

@louis030195
louis030195 / SpawnThingsAboveGround.cs
Last active June 3, 2020 07:15
Unity helper to spawn object above ground or try to spawn objects above ground in a random sphere while keeping a given distance
public static class Spatial
{
/// <summary>
/// Return position above ground relatively from the prefab size
/// Global position
/// </summary>
/// <param name="position"></param>
/// <param name="prefabHeight">Prefab height needed in order to place well on top of ground</param>
/// <param name="transform">Transform parent</param>
/// <param name="layerMask">Layers to ignore</param>
@louis030195
louis030195 / json_to_yaml.sh
Last active September 30, 2020 14:53
JSON to YAML, one liner bash
#!/bin/bash
python3 -m venv .my_super_env && # Yeah random name to avoid erasing local virtualenv
source .my_super_env/bin/activate &&
pip install -q pyyaml &&
python3 -c "import yaml, json, sys
sys.stdout.write(yaml.dump(json.load(sys.stdin)))" \
< $1 > $2 || true
# Remove the temporary venv in any case
rm -rf .my_super_env || true
@jcward
jcward / Readme.txt
Created April 14, 2017 15:08
Generating iOS P12 / certs without Mac OSX Keychain (on linux, windows, etc)
1) Generate a private key and certificate signing request:
openssl genrsa -out ios_distribution.key 2048
openssl req -new -key ios_distribution.key -out ios_distribution.csr -subj '/emailAddress=me@example.com, CN=Example, C=US'
2) Upload CSR to apple at: https://developer.apple.com/account/ios/certificate/create
- choose Production -> App Store and Ad Hoc
3) Download the resulting ios_distribution.cer, and convert it to .pem format:
@tamas-molnar
tamas-molnar / kubectl-shortcuts.sh
Last active March 3, 2024 09:09
aliases and shortcuts for kubectl
alias kc='kubectl'
alias kclf='kubectl logs --tail=200 -f'
alias kcgs='kubectl get service -o wide'
alias kcgd='kubectl get deployment -o wide'
alias kcgp='kubectl get pod -o wide'
alias kcgn='kubectl get node -o wide'
alias kcdp='kubectl describe pod'
alias kcds='kubectl describe service'
alias kcdd='kubectl describe deployment'
alias kcdf='kubectl delete -f'
@karpathy
karpathy / pg-pong.py
Created May 30, 2016 22:50
Training a Neural Network ATARI Pong agent with Policy Gradients from raw pixels
""" Trains an agent with (stochastic) Policy Gradients on Pong. Uses OpenAI Gym. """
import numpy as np
import cPickle as pickle
import gym
# hyperparameters
H = 200 # number of hidden layer neurons
batch_size = 10 # every how many episodes to do a param update?
learning_rate = 1e-4
gamma = 0.99 # discount factor for reward
@patriciogonzalezvivo
patriciogonzalezvivo / GLSL-Noise.md
Last active April 25, 2024 12:16
GLSL Noise Algorithms

Please consider using http://lygia.xyz instead of copy/pasting this functions. It expand suport for voronoi, voronoise, fbm, noise, worley, noise, derivatives and much more, through simple file dependencies. Take a look to https://github.com/patriciogonzalezvivo/lygia/tree/main/generative

Generic 1,2,3 Noise

float rand(float n){return fract(sin(n) * 43758.5453123);}

float noise(float p){
	float fl = floor(p);
  float fc = fract(p);