Skip to content

Instantly share code, notes, and snippets.

naufragio del desastre linda metafísico de producción oncall compwron

Block or report user

Report or block compwron

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@compwron
compwron / wait_for_demo.py
Last active Jan 3, 2020
demo of waiting for a condition
View wait_for_demo.py
import time
from random import randint
def demo():
foo = randint(0, 100)
print(f"int is {foo}")
return foo % 5 == 0
def _wait_for(condition_func, interval=0.5, max_time=15):
View picky_eater_list.txt
1.Miracle Whip
2.Pickles
3.Cilantro
4.Black Jelly Beans
5.Pineapple Pizza
6.Sardines
6.Oysters
8.Sushi
9. Candy Corn
10. Vienna Sausages
@compwron
compwron / ExportKindle.js
Created Dec 21, 2019 — forked from jkubecki/ExportKindle.js
Amazon Kindle Export
View ExportKindle.js
// The following data should be run in the console while viewing the page https://read.amazon.com/
// It will export a CSV file called "download" which can (and should) be renamed with a .csv extension
var db = openDatabase('K4W', '3', 'thedatabase', 1024 * 1024);
getAmazonCsv = function() {
// Set header for CSV export line - change this if you change the fields used
var csvData = "ASIN,Title,Authors,PurchaseDate\n";
db.transaction(function(tx) {
@compwron
compwron / react-router-v4-upgrade-notes.txt
Created Dec 5, 2019
Notes on how to upgrade to react-router v4
View react-router-v4-upgrade-notes.txt
note- we use auth0, some of this is specific to that
steps:
launch and look at the UI to make sure everthing is working
npm update all gently (i.e "npm update" without hand-editing package.json)
dependencies: (these will need the ^ later but for now leave it as is until it's proven to work)
- "react-router": "4.4.0-beta.8",
- react-router-redux -> "react-router-dom": "4.4.0-beta.8",
- "redux-auth-wrapper": "^2.1.0",
(note: add the ^ after changes are done so upgrades will kick in- there are more versions already!!)
@compwron
compwron / hack.js
Created Nov 22, 2019
hack for auth redirect w/ react-router 4 and redux-aut-wrapper
View hack.js
function handleAuthenticated (dispatch) {
lock.on('authenticated', ({ accessToken, idToken, state }) => {
lock.getUserInfo(accessToken, (error, user) => {
if (error) {
return dispatch(lockError(error))
}
setUser(user)
setToken(idToken)
@compwron
compwron / flag_combine.js
Created Nov 15, 2019
just a simple reduce with some domain, pre-refactoring
View flag_combine.js
import {List, Map} from 'immutable'
test('test name goes here', () => {
const currentFlags = List([
Map({id: 7, tag: 'flag/bbb:JAR'}),
Map({id: 6, tag: 'flag/bbb'}),
Map({id: 9, tag: 'flag/ccc:ADV'}),
Map({id: 8, tag: 'flag/bbb:ELI'}),
Map({id: 10, tag: 'flag/ccc:JAR'})
])
@compwron
compwron / sqlalchemy_most_frequent_queries.py
Created Nov 9, 2019
Demo of how to test for n+1 queries produced by sqlalchemy
View sqlalchemy_most_frequent_queries.py
# for use with sqlalchemy
def test_foo():
stmts = []
def catch_queries(conn, cursor, statement, a, b, c):
stmts.append(statement)
event.listen(engine, "before_cursor_execute", catch_queries)
do_thing()
assert _most_frequent_queries(queries=stmts, query_count=4, query_type='SELECT', query_print_length=50) == [('SELECT X FROM Y', 5)]
@compwron
compwron / healthtech.txt
Created Oct 17, 2019
some healthtech places to work
View healthtech.txt
Apple Health
AgileMD
Alpha Health
Alto Pharmacy
Amino Healthcare
Augmedix
Benchling
Carbon Health
Clover Health
Cricket Health
@compwron
compwron / judge.rb
Created Jun 25, 2019
judge.rb aiming for a tie, doesn't work yet
View judge.rb
def pick_tie_jurors(potential_jurors, k)
potential_jurors.combination(k).map do |combo| # 2 3
p_tie = combo.combination(combo.count / 2).map { |possibles| # [2] # [3]
# inverses = [2, 3] - [2] # bug with distinct # [3]
inverses = (combo - possibles).map { |i| 1 - i } # bug with distinct # [3]
acc = 0
possibles.map { |pos|
inverses.map { |inv|
pos * inv
View group_by__and__sliding_window.rb
# group by x
# def time(a_proc)
# start = Time.now
# a_proc.call
# puts Time.now - start
# end
#
# time(Proc.new { code_here })
# time(Proc.new { more_code_here })
You can’t perform that action at this time.