Skip to content

Instantly share code, notes, and snippets.

@alecjacobson
alecjacobson / papers_most_often_cited_in_specific_author_papers.py
Created August 31, 2022 15:05
Frequency Count of Papers Most Cited in a Specific Authors Publications
#!/usr/bin/env python
from semanticscholar import SemanticScholar
from collections import defaultdict
sch = SemanticScholar(timeout=2)
# Replace with author id found in url like
# https://www.semanticscholar.org/author/E.-Catmull/3132499
author = sch.author(3132499)
paperId_counts = defaultdict(int)
paperId_short_recs = {}
for authors_paper_short_rec in author['papers']:
@alecjacobson
alecjacobson / procrusteanarxiv.sh
Last active March 16, 2022 21:16
This script will attempt to create a copy of the input tex directory whose total size is less than the 10000 KBs (i.e., 10MBs) limit of ArXiv.
#!/bin/bash
if [ -z "$1" ];then
echo "USAGE:
procrusteanarxiv path/to/input/dir/containing/tex/files/
This script tested with dependencies:
gs Ghostscript version 9.27 (9.21 is buggy)
@johncip
johncip / phaser-2-to-3.md
Last active March 10, 2024 08:16
Moving from Phaser 2 to 3

Moving from Phaser 2 → 3: an incomplete guide

Summary

  • I found that the best thing was to ask myself what this or that line was meant to accomplish, and then to search labs.phaser.io for a Phaser 3 example of that task.
  • Usually the issue is just that a function has moved, or some property now requires a setter.
  • There's a real migration guide here: part 1, part 2

Scenes have replaced states (and the game object… mostly)

@bishboria
bishboria / springer-free-maths-books.md
Last active March 22, 2024 11:19
Springer made a bunch of books available for free, these were the direct links
@alexshtf
alexshtf / constexpr_sqrt.cpp
Last active June 7, 2023 11:19
Constexpr version of c++ square root (for doubles)
#include <limits>
namespace Detail
{
double constexpr sqrtNewtonRaphson(double x, double curr, double prev)
{
return curr == prev
? curr
: sqrtNewtonRaphson(x, 0.5 * (curr + x / curr), curr);
}
@justecorruptio
justecorruptio / 2048.c
Created April 4, 2014 03:49
Tiny 2048 in C!
M[16],X=16,W,k;main(){T(system("stty cbreak")
);puts(W&1?"WIN":"LOSE");}K[]={2,3,1};s(f,d,i
,j,l,P){for(i=4;i--;)for(j=k=l=0;k<4;)j<4?P=M
[w(d,i,j++)],W|=P>>11,l*P&&(f?M[w(d,i,k)]=l<<
(l==P):0,k++),l=l?P?l-P?P:0:l:P:(f?M[w(d,i,k)
]=l:0,++k,W|=2*!l,l=0);}w(d,i,j){return d?w(d
-1,j,3-i):4*i+j;}T(i){for(i=X+rand()%X;M[i%X]
*i;i--);i?M[i%X]=2<<rand()%2:0;for(W=i=0;i<4;
)s(0,i++);for(i=X,puts("\e[2J\e[H");i--;i%4||
puts(""))printf(M[i]?"%4d|":" |",M[i]);W-2
@timo22345
timo22345 / flatten.js
Last active March 13, 2024 17:06
Flatten.js, general SVG flattener. Flattens transformations of SVG shapes and paths. All shapes and path commands are supported.
<!doctype html>
<html>
<title>Flatten.js, General SVG Flattener</title>
<head>
<script>
/*
Random path and shape generator, flattener test base: https://jsfiddle.net/fjm9423q/embedded/result/
Basic usage example: https://jsfiddle.net/nrjvmqur/embedded/result/
@jterhune
jterhune / PicasaToXMP.py
Last active September 30, 2018 23:05 — forked from atotic/PicasaToXMP.py
#!/usr/bin/python
# prerequisite: http://www.exiv2.org/download.html
import sys
import os.path
import re
import subprocess
def process_ini(fname):
# print "found ini " + fname + "\n"
@atotic
atotic / PicasaToXMP.py
Created November 28, 2012 17:31
Convert Picasa star ratings to XMP format
#!/usr/bin/python
# prerequisite: http://www.exiv2.org/download.html
import sys
import os.path
import re
import subprocess
def process_ini(fname):
# print "found ini " + fname + "\n"
@hagino3000
hagino3000 / client.js
Created December 8, 2011 18:42
WebSocket with binary data
var socket = null;
function bootstrap() {
// 適当な図形を描画
var c = document.getElementById('mycanvas');
var ctx = c.getContext('2d');
ctx.globalalpha = 0.3;
for(var i=0; i<1000; i++) {
ctx.beginPath();