Skip to content

Instantly share code, notes, and snippets.

View typebrook's full-sized avatar

Hsieh Chin Fan typebrook

View GitHub Profile
@drmingdrmer
drmingdrmer / voice-input.py
Last active October 23, 2023 00:45
Voice input in CLI and vim, via azure speech service
#!/usr/bin/env python
# coding: utf-8
# Enable azure speech service:
# https://docs.azure.cn/zh-cn/ai-services/speech-service/get-started-speech-to-text?tabs=macos%2Cterminal&pivots=programming-language-python
#
# Setup environement variables key and region that are found at page
# https://portal.azure.com
# Home -> Azure AI Service | Speech service -> <your_service_name>
#
@miglen
miglen / packagejson.py
Created February 10, 2021 11:55
Dirty check for non existing public npm dependencies
#!/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

Before

  Text("Hello")
  Text("world")

After apply <Leader>ai on both line selected by V

👇 cursor here
@Closer2U
Closer2U / _000 Gist Shortcuts.md
Last active March 4, 2021 01:32
Gist Shortcuts for publishing, previewing etc...
#!/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 November 1, 2024 00:01
`adb pull` from app data directory without root access

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

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

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
<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');
#!/bin/bash
# set -x
if [ -z $1 ] ; then
echo "Usage: $0 url_of_zsync"
exit -1
fi
cd $(dirname $0)