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
package main
import (
"crypto/tls"
"fmt"
"log"
"net"
"net/mail"
"net/smtp"
"os"
@alexflint
alexflint / date-range-from-data-studio.sql
Last active January 4, 2022 16:09
Date range from Google Data Studio in Bigquery SQL
SELECT
DATETIME(`begin`, 'US/Eastern') as `when`,
`host`,
`bytes`,
FROM
`mydataset.mytable`
WHERE
`begin` >= TIMESTAMP(PARSE_DATE('%Y%m%d', @DS_START_DATE), 'US/Eastern')
AND `begin` <= TIMESTAMP(DATE_ADD(PARSE_DATE('%Y%m%d', @DS_END_DATE), INTERVAL 1 DAY), 'US/Eastern')
/tmp/ccFWmtEP.o: In function `main':
main.cpp:(.text+0x1e5): undefined reference to `scy::ConsoleChannel::ConsoleChannel(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, scy::LogLevel, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
main.cpp:(.text+0x386): undefined reference to `scy::LogStream::LogStream(scy::LogLevel, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, void const*, char const*)'
/tmp/ccFWmtEP.o: In function `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > cricket::VectorToString<cricket::AudioCodec>(std::vector<cricket::AudioCodec, std::allocator<cricket::AudioCodec> > const&)':
main.cpp:(.text+0xe87): undefined reference to `cricket::AudioCodec::ToString[abi:cxx11]() const'
/tmp/ccFWmtEP.o: In function `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > cricket::VectorToString<webrtc::RtpExtension>(std::vector<
@alexflint
alexflint / symbolic_determinant.py
Created June 19, 2015 23:03
Compute a symbolic determinant in python
import functools
import operator
def permutations_impl(xs):
if len(xs) == 1:
yield xs, 1
else:
for i in range(len(xs)):
xs[0], xs[i] = xs[i], xs[0]

Keybase proof

I hereby claim:

  • I am alexflint on github.
  • I am alexflint (https://keybase.io/alexflint) on keybase.
  • I have a public key whose fingerprint is E997 235E 99A7 876C 6B46 E2B8 AB74 0478 793D 7B74

To claim this, I am signing this object:

@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
@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: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)
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.),
[==========] 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