Skip to content

Instantly share code, notes, and snippets.

@fhk
fhk / make_playlist_from_songs.py
Created November 21, 2016 04:38
csv to Google API youtube playlist maker
import httplib2
import os
import sys
import csv
from apiclient.discovery import build
from apiclient.errors import HttpError
from oauth2client.client import flow_from_clientsecrets
from oauth2client.file import Storage
@fhk
fhk / RF_modeling_mmWave_propagation.ipynb
Created June 25, 2018 22:54
RF_modeling_mmWave_propagation
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fhk
fhk / Cali_broadband.ipynb
Created January 7, 2019 20:23
Cali_broadband
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fhk
fhk / US.txt
Created February 15, 2016 10:27
Depends. What kind of field are you in? Are your skills in demand in NYC right now? Do you know anyone else in your field in the city who you can ask?
I'm an Australian who has been living in NYC for over a year now, and I get asked this constantly. I usually answer the questions from the point-of-view of a Web Designer, which may or may not be useful to you, depending on your situation.
But here goes:
Americans, though they speak English are not like Australians
Even though you've watched them your whole life on TV and in the movies, you're still not going to arrive attuned to the nuances of the American workplace culture.
wget https://golang.org/dl/go1.16.7.linux-amd64.tar.gz;
rm -rf /usr/local/go && tar -C /usr/local -xzf go1.16.7.linux-amd64.tar.gz;
export PATH=$PATH:/usr/local/go/bin;
export GOPATH=$HOME/go;
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin;
go get github.com/fraugster/parquet-go/cmd/csv2parquet;
@fhk
fhk / IncreasingCostMST_Generator.py
Created April 22, 2022 16:57 — forked from niroyb/IncreasingCostMST_Generator.py
Searches a graph and yields all the minimum spanning trees in order of increasing cost. This could be used to solve minimum spanning trees with constraints by yielding trees until we reach the first one which satisfies a constraint. For example it could solve the degree constrained minimum spanning tree DCMST
#!/Usr/bin/env python
# -*- coding: utf-8 -*-
'''
Searches a graph and yields all the minimum spanning trees in order of increasing cost.
This could be used to solve minimum spanning trees with constraints by yielding trees until
we reach the first one which satisfies a constraint.
For example it could solve the degree constrained minimum spanning tree DCMST
'''
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fhk
fhk / trello_2csv.py
Created March 8, 2023 19:16
Yay JSON export isn't premium but csv is. Lets just move some data...
import sys
import json
import csv
def main():
input_json = sys.argv[1]
output_csv_data = [['name', 'lastdate', 'desc', 'shorturl']]
with open(input_json, mode='r') as ijson:
data = json.load(ijson)
@fhk
fhk / lp_solver_wasm.md
Last active February 5, 2024 15:20
Compiling a linked linear programming solver library

Linear Programming Solver running in the browser?

So I wanted to see if I could get a solver running in the browser.

Why you might ask? Well its pretty typical to need to deploy a back end for a webapp or even to have a specific install on your OS.

This makes things clunky if we wanted to say:

  1. Visualize solutions in realtime using some js libs on the client side
  2. Solve models on the client side of a web app
# Some quick snippets for points to lines
address_df = pd.DataFrame([[0, Point([c for c in h3.cell_to_latlng(h3_8)[::-1]])]], columns=['id', 'geometry'])
address_gdf = gpd.GeoDataFrame(address_df, geometry="geometry", crs="epsg:4326")
gdf = gpd.read_file(
"./data/all_the_data.fgb",
engine="pyogrio", bbox=location_box)
gdf = gdf.to_crs('epsg:3310') # https://epsg.io/3310