Skip to content

Instantly share code, notes, and snippets.

View sometimescasey's full-sized avatar

Casey Li sometimescasey

View GitHub Profile
convert -delay 20 -loop 0 -dispose previous *.png myimage.gif
@sometimescasey
sometimescasey / django_heroku_setup.md
Last active July 1, 2021 22:26
Django Heroku Setup notes

Django Heroku setup notes

How to do normal Django manage commands?

I.e. create superuser, check migrations, run migrations...

Also, don't make migrations on the Heroku machine. Make them locally and commit to version control.

heroku run python manage.py showmigrations --app myapp
heroku run python manage.py migrate --app myapp
heroku run python manage.py createsuperuser --app myapp
@sometimescasey
sometimescasey / aws-lightsail-renew-cert.md
Last active April 4, 2021 20:37
Notes re renewing AWS Lightsail Bitnami Ghost instance certificate

Renewing SSL certificates for https loading in Bitnami AWS Lightsail Ghost blog

Regenerate server.crt and server.key

Once you've already set up your certs using bncert-tool, the thing you actually need to replace every 30 days is the base certificates which you created by following https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-using-lets-encrypt-certificates-with-nginx.

You'll need to do the DNS challenges again using TXT records in Lightsail.

Make a note of the expiry date.

Replace symlinks (example below is for my Ghost blog, ymmv):

@sometimescasey
sometimescasey / launch.json
Created February 19, 2021 12:07
launch.json for debugging React in VS Code
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch localhost",
"type": "chrome",
"request": "launch",
@sometimescasey
sometimescasey / aws_new_domain.md
Last active June 24, 2020 14:06
AWS - Route 53, CloudFront, and certificate

Note

This is a note to self of setup steps when purchasing a new domain on Namecheap, pointing its DNS to Route 53, requesting an SSL certificate, and setting up a CloudFront distribution for it to point to an S3 bucket.

1. Point NameCheap domain Custom DNS to Route 53

Create a new hosted zone for the new domain in Route 53. Will be given the correct nameservers to use under record type 'NS'. Add these values in NameCheap under 'Custom DNS'.

2. Request new SSL certificate for example.com and *.example.com

@sometimescasey
sometimescasey / screen.md
Last active April 9, 2019 16:22
Screen basics

I always forget the basics of screen:

See what's currently running

screen -ls

Make a new named screen session, do stuff, detach

screen -S nameofsession
@sometimescasey
sometimescasey / CUDA_exports.md
Created December 20, 2018 00:05
Quick reminder of how to export CUDA_PATH, CUDA_HOME, and LD_LIBRARY_PATH.

I always forget how to do this on a new system:

export CUDA_PATH=/usr/local/cuda-9.2
export CUDA_HOME=/usr/local/cuda-9.2
export LD_LIBRARY_PATH=/usr/local/cuda-9.2/lib64

@sometimescasey
sometimescasey / offline.c
Last active August 5, 2018 13:13
CLRS Problem 21-1 Offline-Minimum using Disjoint Set Forest w path-compression and union-by-rank
/*
Summer 2018
CSC263 Assignment 4 Question 7
CLRS Problem 21-1, Offline-Minimum
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "disjoint.h"
@sometimescasey
sometimescasey / disjoint.h
Last active August 5, 2018 03:59
CLRS 21.3-4: Disjoint set forest with union-by-rank and path compression, plus circular linked-list backwards pointers for printing
/*
CLRS 21.3-4
Suppose that we wish to add the operation PRINT-SET(x), which is given a node x
and prints all the members of x’s set, in any order. Show how we can add just
a single attribute to each node in a disjoint-set forest so that PRINT-SET(x) takes
time linear in the number of members of x’s set and the asymptotic running times
of the other operations are unchanged. Assume that we can print each member of
the set in O(1) time.
*/
@sometimescasey
sometimescasey / reachable.c
Last active August 2, 2018 22:53
CLRS 22-4 - minimum reachable
/*
Summer 2018
CSC263 Assignment 4 Question 2
CLRS 22-4
Let G = (V,E) be a directed graph in which each vertex u in V is labeled with
a unique integer L(u) from the set {1, 2, ...|V|}. For each vertex u in V , let
R(u) = {v in V: u has a path to v} be the set of vertices that are reachable from u.
Define min(u) to be the vertex in R(u) whose label is minimum, i.e., min(u) is the vertex v such that L(v) = min{L(w): w in R(u)}. Give an O(V+E) algorithm that