Skip to content

Instantly share code, notes, and snippets.

View alexflint's full-sized avatar
💭
Watching Soryu Forall videos on youtube

Alex Flint alexflint

💭
Watching Soryu Forall videos on youtube
View GitHub Profile
@alexflint
alexflint / gist:4313894
Created December 16, 2012 22:55
A google apps script that reminds me that I have a package delivery. It schedules an SMS for the time I arrive home (about 6:30pm) on any day when I receive an email with a certain label.
/**
* Author: [email protected]
* Date: December 16, 2012
*
* A google apps script that reminds me that I have a package delivery. It
* schedules an SMS for the time I arrive home (about 6:30pm) on any day when
* I receive an email with a certain label.
*/
////////////////////////////////////////////////////////////////////////////////
@alexflint
alexflint / gist:8403817
Created January 13, 2014 17:01
Test for images that are too dark
uint8_t ComputeMax(const uint8_t* image, size_t width, size_t height, size_t stride) {
uint8_t m = 0;
for (int i = 0; i < height; i++) {
const uint8_t* p = &image[i*stride];
for (int j = 0; j < width; j++) {
if (*p > m) {
m = *p;
}
p++;
@alexflint
alexflint / worklog.py
Created March 13, 2014 21:30
Command line tool to copy directory snapshots to a timestamped worklog database
#!/usr/local/bin/python
import os
import sys
import shutil
import datetime
WORKLOG_DIR = 'Worklogs'
datetime_fmt = '%Y %m %d %I.%M%p' # eg: "2014 01 03 11.45AM"
@alexflint
alexflint / make_video.py
Last active September 28, 2024 02:03
Create a video from a sequence of images (or PDFs) in python (using ffmpeg internally)
import os
import sys
import tempfile
import argparse
import subprocess
NATURAL_FPS = 30.
# Formats convertible by imagemagick:
CONVERTIBLE_EXTENSIONS = ['png', 'jpeg', 'jpg', 'pdf', 'pgm', 'bmp']
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from VioBehavioralTest
[ RUN ] VioBehavioralTest.VioBehavioralTest
Measurement[0]: -0.0330176 -1.02655
Bearing[0]: -0.023033 -0.716117 0.6976
Ii_q_G[0]: -0.590556 -0.511007 -0.488375 0.389364
G_p_Ii[0]: -4.69997e-05 -0.000133962 -5.4736e-05
Measurement[1]: -0.0341568 -1.02556
RED_KEYS = ((0., 0.),
(0.35, 0.),
(0.66, 1.),
(0.89, 1.),
(1., 0.5))
GREEN_KEYS = ((0., 0.),
(0.125, 0.),
(0.375, 1.),
(0.64, 1.),
(0.91, 0.),
@alexflint
alexflint / gist:10d9a11532f17daf0bff
Created July 24, 2014 22:10
Example of parsing arguments and calling into adb from python
#!/bin/env python
import os
import argparse
import subprocess
from pathlib import Path
def main():
argument_parser = argparse.ArgumentParser(description="Android unittest runner")
argument_parser.add_argument('--gtest_output', type=str)
@alexflint
alexflint / gist:dcea786628af3b43d21a
Created September 23, 2014 13:30
Path containing 382 points
-0.001154 0.006367
0.003186 0.016711
0.009460 0.018219
0.017081 0.009656
-0.195029 0.119663
-1.042430 0.084657
-1.871992 -0.233983
-2.585808 -0.937707
-2.413155 -1.989106
-2.057261 -3.181412
@alexflint
alexflint / gist:4eac476ca9dfce7a32f9
Created February 24, 2015 03:14
Snapshot of user-node memory usage after loading std lib + ~100 go-search packages
flat flat% sum% cum cum%
40.53MB 18.28% 18.28% 52.03MB 23.47% github.com/kiteco/kiteco/kite-go/lang/golang.func·004
27.50MB 12.41% 30.69% 28MB 12.63% go/parser.(*parser).parseIdent
21.53MB 9.71% 40.40% 21.53MB 9.71% strings.Replace
13MB 5.87% 46.27% 91.06MB 41.08% github.com/kiteco/kiteco/kite-go/lang/golang.(*SnippetParser).Snippets
12MB 5.41% 51.68% 12MB 5.41% github.com/kiteco/kiteco/kite-go/lang/golang.(*Parser).tokenString
10.28MB 4.64% 56.32% 101.33MB 45.71% github.com/kiteco/kiteco/kite-go/lang/golang.(*SnippetCollection).addSnippetsFromBuffer
8.50MB 3.83% 60.15% 8.50MB 3.83% go/parser.(*parser).declare
6.50MB 2.93% 63.08% 18MB 8.12% go/parser.(*parser).parseCallOrConversion
6MB 2.71% 65.79% 6MB 2.71% go/parser.(*parser).shortVarDecl