Skip to content

Instantly share code, notes, and snippets.

View bradleybossard's full-sized avatar

Bradley Bossard bradleybossard

View GitHub Profile
@glebm
glebm / RenderWhitespace.md
Last active September 26, 2017 11:17
Render whitespace on GitHub
@borgfriend
borgfriend / maya2017install.sh
Last active April 13, 2024 13:34
Maya 2017 Installation on Ubuntu 16.04
#!/bin/bash
#Make sure we’re running with root permissions.
if [ `whoami` != root ]; then
echo Please run this script using sudo
echo Just type “sudo !!”
exit
fi
#Check for 64-bit arch
if [uname -m != x86_64]; then
@syafiqfaiz
syafiqfaiz / how-to-copy-aws-rds-to-local.md
Last active June 15, 2024 15:20
How to copy production database on AWS RDS(postgresql) to local development database.
  1. Change your database RDS instance security group to allow your machine to access it.
    • Add your ip to the security group to acces the instance via Postgres.
  2. Make a copy of the database using pg_dump
    • $ pg_dump -h <public dns> -U <my username> -f <name of dump file .sql> <name of my database>
    • you will be asked for postgressql password.
    • a dump file(.sql) will be created
  3. Restore that dump file to your local database.
    • but you might need to drop the database and create it first
    • $ psql -U <postgresql username> -d <database name> -f <dump file that you want to restore>
  • the database is restored
@subfuzion
subfuzion / curl.md
Last active June 20, 2024 13:48
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

import re
# Supported tokens and their operations
ORDER_OF_OPERATIONS = ["MULTIPLY", "DIVIDE", "ADD", "SUBTRACT"]
scanner = re.Scanner([
(r"([0-9]+)", lambda x, y: int(y)),
(r"\+", lambda x, y: "ADD"),
(r"-", lambda x, y: "SUBTRACT"),
(r"\*", lambda x, y: "MULTIPLY"),
(r"/", lambda x, y: "DIVIDE"),
function MathSolver() {
this.infixToPostfix = function(infix) {
var outputQueue = "";
var operatorStack = [];
var operators = {
"^": {
precedence: 4,
associativity: "Right"
},
// by d whyte
int[][] result;
float t;
float ease(float p) {
return 3*p*p - 2*p*p*p;
}
float ease(float p, float g) {
@Zulko
Zulko / moviepy_motion_blur.py
Last active December 10, 2022 07:03
Motion blur in MoviePy.
import numpy as np
def supersample(clip, d, nframes):
""" Replaces each frame at time t by the mean of `nframes` equally spaced frames
taken in the interval [t-d, t+d]. This results in motion blur."""
def fl(gf, t):
tt = np.linspace(t-d, t+d, nframes)
avg = np.mean(1.0*np.array([gf(t_) for t_ in tt]),axis=0)
return avg.astype("uint8")
return clip.fl(fl)
@wdullaer
wdullaer / docker-cleanup
Last active August 17, 2023 14:17
Cleanup unused Docker images and containers
#!/bin/sh
# Cleanup docker files: untagged containers and images.
#
# Use `docker-cleanup -n` for a dry run to see what would be deleted.
untagged_containers() {
# Print containers using untagged images: $1 is used with awk's print: 0=line, 1=column 1.
# NOTE: "[0-9a-f]{12}" does not work with GNU Awk 3.1.7 (RHEL6).
# Ref: https://github.com/blueyed/dotfiles/commit/a14f0b4b#commitcomment-6736470
docker ps -a | tail -n +2 | awk '$2 ~ "^[0-9a-f]+$" {print $'$1'}'
anonymous
anonymous / gist:10675250
Created April 14, 2014 19:11
Motion Blur + Chromatic Aberration
// by dave @ beesandbombs.tumblr.com >:)
void setup() {
setup_();
result = new int[width*height][3];
result_ = new int[width*height][3];
}
int[][] result, result_;
float time;