Skip to content

Instantly share code, notes, and snippets.

@cdrini
cdrini / Makefile
Last active August 29, 2015 14:15
General C++ Makefile (based on CS246 teachings)
CXX = g++
CXXFLAGS = -std=c++11 -Wall -MMD -g
#Wall: Shows all warnings
#MMD: Creates dependency files
#g: Necessary when using gdb for debugging
OBJECTS = main.o
DEPENDS = ${OBJECTS:.o=.d}
EXEC = exec
${EXEC}: ${OBJECTS}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cdrini
cdrini / Unicode Normalization Forms.md
Last active November 2, 2017 10:08
Notes on Unicode Normalization Forms

These are notes from my (relatively) brief skim of http://unicode.org/reports/tr15/ . All graphics and tables are from there.

So basically unicode lets you define the same character in multiple ways, but recognizes that there are 2 broad types of character equivalence:

  • Canonical Equivalence which handles, amongst other cases:
    • compositions like Å ≡ A+ ̊ (or \u00c5\u0041\u030a)
    • redundant definitions: Both \u2126 and \u03a9 display as the ohm symbol (Ω)
  • Compatibility Equivalence which handles, amongst other cases:
    • characters which are rendered differently, but can be seen as pretty much the same (non-breaking space ≡ regular space, i⁹ ≡ i9, ℌ ≡ H, etc). Note that Å is not compatibility equivalent to A.

30.8 Animating Camera motion

  • bunch of guidelines for how to control a camera...
  • often want to specify what the camera 'looking at'; then animate it along a path and let the computer ensure it looks at its target throughout the animation

30.9 Tools for Shape Animation

Skeletons

  • (Armatures/Rigging in Blender)
  • Give a 3d model bones/joints separate from the model (not hierarchical like puppet)
  • Manipulate the (simpler) skeleton to manipulate the (complex) model
@cdrini
cdrini / index.html
Last active December 23, 2017 01:30
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="robots" content="NONE,NOARCHIVE" />
<title>&lt;type &#39;exceptions.AttributeError&#39;&gt; at /</title>
<style type="text/css">
html * { padding:0; margin:0; }
body * { padding:10px 20px; }
@cdrini
cdrini / uw fall 2018 important dates.csv
Last active September 6, 2018 15:32
UW Important Dates as Outlook CSV
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 6.
Subject,Start Date,End Date,All Day Event,Description,Show Time As
Course selection period (Returning Waterloo students),2018/5/23,2018/5/29,TRUE,,3
Course selection period (New Waterloo students),2018/7/3,2018/7/10,TRUE,,3
Next term's class schedule viewable in Quest,2018/7/18,2018/7/19,TRUE,,3
Drop/Add period begins (New Waterloo students),2018/7/19,2018/7/20,TRUE,"Dates listed indicate Quest appointment period. <a href=""https://uwaterloo.ca/quest/help/students/how-do-i/view-my-appointment-time-beginning-drop-add"">See how to view appointment time for the beginning of drop/add</a>. Enrolment for all students continues beyond enrolment appointments until the end of the add period.",3
Drop/Add period begins (Returning Waterloo students),2018/7/23,2018/7/25,TRUE,"Dates listed indicate Quest appointment period. <a href=""https://uwaterloo.ca/quest/help/students/how-do-i/view-my-appointment-time-beginning-drop-add"">See how to view appointment time for the beginning of drop/add</a>. Enrolment for all students c
@cdrini
cdrini / README.md
Last active May 27, 2018 22:01
Java vs. Kotlin Snippets

1. Getters/Setters

Java

class Circle {
  private double radius = 10;
  public double getRadius() { return this.radius; }
  public void setRadius(double r) { this.radius = r; }
@cdrini
cdrini / README.md
Last active April 15, 2019 04:03
OL Cached Changes Bug Investigation

Try to find the commit that introduced the bug

Notes: https://coda.io/d/OL-Caching-Bug-Investigation_dglSLSKf2l1/_suyCn

Methodology

  1. Checkout the commit in question (e.g. git checkout d3f63c1)
  2. Run the script to make sure the environment is set up (bash scripts/run-bisect.sh)
  3. I try to do a curl-edit (below) but it didn't work.
  4. Go to the home page; click on the first book (Complete works of mark twain), click on its first edition
  5. edit the edition to include some garbage text after the title and hit enter to save
@cdrini
cdrini / Fetching ocaids.js
Last active July 13, 2020 21:58
Misc ia snippets
// Run anywhere on dev.openlibrary.org in console
var edition_ocaids = `
isbn_9780316253017
olivertwist01dick
`.trim().split('\n').map(x => x.trim())
var url = 'https://dev.openlibrary.org/search.json?' + new URLSearchParams({
q: `ia:(${removed_ocaids.join(' OR ')})`,
fields: 'key,ia',
const packageJson = require('./package.json');
const shrinkwrapJson = require('./npm-shrinkwrap.json');
const fetch = require('node-fetch');
const fs = require('fs');
const { execSync } = require('child_process');
const GH_API_ROOT = 'https://api.github.com';
const REPO = "internetarchive/bookreader";
async function main() {
// Make sure branching off of latest master