Skip to content

Instantly share code, notes, and snippets.

View typebrook's full-sized avatar

Hsieh Chin Fan typebrook

View GitHub Profile
@miglen
miglen / packagejson.py
Created February 10, 2021 11:55
Dirty check for non existing public npm dependencies
View packagejson.py
#!/bin/env python3
# https://www.bleepingcomputer.com/news/security/researcher-hacks-over-35-tech-firms-in-novel-supply-chain-attack/
# The following script finds all package.json files in the current dir and checks if there are referenced any
# dependencies that no public package is available for, making your application vulnerable to supply-chain attack.
# Simply run ./packagejson.py in your root repository direcotory.
import json
import requests
from pathlib import Path
import urllib.parse
@Closer2U
Closer2U / _000 Gist Shortcuts.md
Last active March 4, 2021 01:32
Gist Shortcuts for publishing, previewing etc...
View _000 Gist Shortcuts.md
View samizdat-shell-help.bash
#!/bin/bash
###
### my-script — does one thing well
###
### Usage:
### my-script <input> <output>
###
### Options:
### <input> Input file to read.
### <output> Output file to write. Use '-' for stdout.
@jevakallio
jevakallio / readme.md
Last active September 28, 2023 12:37
`adb pull` from app data directory without root access
View readme.md

TL;DR;

com.package.name is your app identifier, and the file path is relative to the app user's home directory, e.g. '/data/user/0/com.package.name.

adb shell run-as com.package.name cp relative/path/file.ext /sdcard
adb pull /sdcard/file.ext

See long explanation below.

@ambientlight
ambientlight / rfc_offline_first_backend_arch.md
Last active May 26, 2020 05:02
RFC: Organic backend architecture for offline-first application via logux
View rfc_offline_first_backend_arch.md

RFC: Organic backend architecture for offline-first application via logux

Goal

Lay out the base ground-work for distributed backend system architecture designed to support offline usecases that involve synchronization of client application during the events when client applications are offline for a periods that exceed days or weeks. Additionally the architecture is meant to support easy-to-replicate offline servers, which act as ad-hoc (edge) synchronization endpoints that are capable of supporting a full range of available business-specific functionality, thus making clients unaware of unexisting internet connectivity between ad-hoc and cloud-hosted server.

Non-goal

This RFC is not meant to describe any application-specific business logic (another one for this) such as features provided by solution hosted in such backend system, entity-relationship diagrams modeled in DBs etc.

Basis

The base area of exploration / experimentation lies around Logux which conceptually can

View find_chars.py
import freetype
import osmium
import sys
face = freetype.Face("/System/Library/Fonts/STHeiti Medium.ttc")
def check_tags(t,o):
for k,v in o.tags:
if k == 'name':
for char in v:
@JoeThunyathep
JoeThunyathep / index.html
Created April 20, 2020 17:28
Index file for Cesium NYC application
View index.html
<html lang="en">
<head>
<meta charset="utf-8">
<script src="https://cesium.com/downloads/cesiumjs/releases/1.68/Build/Cesium/Cesium.js"></script>
<link href="https://cesium.com/downloads/cesiumjs/releases/1.68/Build/Cesium/Widgets/widgets.css" rel="stylesheet">
</head>
<body>
<div id="cesiumContainer" style="width: 100%; height:100%"></div>
<script>
var viewer = new Cesium.Viewer('cesiumContainer');
View zsync.sh
#!/bin/bash
# set -x
if [ -z $1 ] ; then
echo "Usage: $0 url_of_zsync"
exit -1
fi
cd $(dirname $0)
@mcdlee
mcdlee / u_and_n.ipynb
Last active June 23, 2020 02:29
Using PyTorch to classify my writing
View u_and_n.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.