Skip to content

Instantly share code, notes, and snippets.

@dangmai
dangmai / iotlink.groovy
Created February 17, 2023 05:27
IOTLink Machine Hubitat

Keybase proof

I hereby claim:

  • I am dangmai on github.
  • I am dangmai (https://keybase.io/dangmai) on keybase.
  • I have a public key whose fingerprint is D3B9 A561 E16B 8625 C784 23E5 9B3E 5E5F E2B9 117D

To claim this, I am signing this object:

@dangmai
dangmai / ipxe.pxe
Last active December 4, 2020 08:02
IPXE
chain --autofree https://boot.netboot.xyz
# https://boxstarter.org/package/url?https://gist.githubusercontent.com/dangmai/eaa8fed8f116fd2d90f3d0df62f50cad/raw/test-bs.ps1
choco install firefox
Invoke-Reboot
choco install flashplayerplugin
@dangmai
dangmai / boxstarter.ps1
Last active October 26, 2023 18:09
Boxstarter Windows Workstation
# Open in IE: https://boxstarter.org/package/url?https://gist.githubusercontent.com/dangmai/f3c30a601099bb0e6ee0dc24b2713180/raw/boxstarter.ps1
# Prompt for inputs
$pcName = Read-Host 'Specify PC Name'
$jumpcloudconnectKey = Read-Host 'Specify JumpCloud Connect Key'
#---- TEMPORARY ---
Disable-UAC
#--- Windows Settings ---
@dangmai
dangmai / manual-jorje-update.bash
Created February 4, 2020 16:41
Manually trigger apex-ast-serializer jorje update
curl -H "Accept: application/vnd.github.everest-preview+json" \
-H "Authorization: token <your-token-here>" \
--request POST \
--data '{"event_type": "manual-jorje-update"}' \
https://api.github.com/repos/dangmai/apex-ast-serializer/dispatches
@dangmai
dangmai / spotify2csv.js
Created January 8, 2020 05:43
Spotify Tracklist to CSV
Array.from(document.querySelectorAll("li.tracklist-row")).map(it => [it.querySelector(".tracklist-name").innerText, it.querySelector(".tracklist-row__artist-name-link").innerText, it.querySelector(".tracklist-duration").innerText].join("\t")).join("\r\n")
function FindProxyForURL(url, host) {
return "SOCKS5 localhost:9001; SOCKS5 localhost:9002";
}
@dangmai
dangmai / migrate-docker-compose-volumes.sh
Last active October 11, 2018 16:40
Send Docker Compose Volumes to a different host
#!/bin/bash
# It's best to do ssh-copy-id to the destination before running this script
# This script takes 3 params:
# The first is the prefix for the volume names, usually it's the docker compose dir name without special chars
# Second is the user@host ssh location
# Third optional: Replace the original prefix with a different prefix on the destrination
docker volume ls --format "{{.Name}}" | grep "^${1}" | while read vol
do
@dangmai
dangmai / routing_sim.py
Created February 18, 2013 22:16
Simulation for routing performances in Python using different routing methods. Inspired by RapGenius R [gist](https://gist.github.com/toddwschneider/4947326).
#!/usr/bin/env python
"""
Simulation of Heroku performances under different routing mechanisms (random/
naive vs intelligent). Inspired by RapGenius' simulation, which can be found
at http://rapgenius.com/James-somers-herokus-ugly-secret-lyrics.
This simulation uses numpy, scipy and pandas for data management/processing,
and it has slightly different algorithm than the simulation by RapGenius,
though the result is very similar.