Skip to content

Instantly share code, notes, and snippets.

@ashatch
ashatch / mirror-a-git-repo
Created September 8, 2020 14:58
Mirroring a repo with ability to update those changes
#!/usr/bin/env bash
# copying from...
sourceRepo=git@bitbucket.org:org/some-repo.git
# to...
destRepo=git@github.com:org/some-repo.git
# using local folder...
localBareRepo=some/local/bare-repo-folder
if [[ ! -d ${localBareRepo} ]]; then
find . -iname "*.md" | cpio -pdm /path/to/another/place

Install

brew install dnsmasq

Config

This assumes setting up dnsmasq on 10.127.0.1. See here.

@ashatch
ashatch / osx-loopback-alias-howto.md
Last active May 18, 2020 08:38
osx loopback alias surviving reboot

Create this the following at this location: /Library/LaunchDaemons/com.user.lo0-alias.plist

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd > 
<plist version="1.0"> 
<dict> 
  <key>Label</key> 
  <string>com.user.lo0-loopback</string> 
 ProgramArguments 
@ashatch
ashatch / docker-compose.yml
Created January 2, 2020 11:00
DynamoDb Local in Docker
version: '3'
services:
dynamodb-local:
image: "amazon/dynamodb-local"
ports:
- "9460:8000"
@ashatch
ashatch / WaitForElb.sh
Created June 10, 2019 13:16
Bash 1-liner for exponential backoff while waiting for an ELB to become healthy
WAIT_TIMEOUT=0; until [ $(aws elbv2 describe-target-health --target-group-arn ${TARGET_GROUP_ARN} --query 'TargetHealthDescriptions[*].TargetHealth.State' --output text) == "healthy" ] || [ ${WAIT_TIMEOUT} -eq 2 ]; do sleep $(( WAIT_TIMEOUT++ )); echo "waiting for ${WAIT_TIMEOUT}s"; done
@ashatch
ashatch / ESP8266_Arduino_Starter_Intructions.MD
Last active February 20, 2019 16:38
How to get an ESP8266 12E board up and running in Arduino
@ashatch
ashatch / ShowTraversalOrderForDAG
Created August 31, 2018 14:59
Show the traversal order taken by postOrderTraversal for a DAG
import com.google.common.base.Function;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.TreeTraverser;
import java.util.stream.Collectors;
public class ShowTraversalOrderForDAG {
public static void main(String[] args) {
/* A
int LaserState = LOW; // The variable that stores the state of the laser beam.
int sensor = 8 ; // Change this value to calibrate your harp's sensor
int delaylaser = 5; // If you increase this, the laser will be brighter, but the harp will be less fluid
int delaymotor = 3; // This variable affects the speed, and fluidity of the harp.
int LaserPin = 7; // Tell the arduino that the laser is on pin 7
int motorPin1 = 8; //Use these names for the pin numbers.
int motorPin2 = 9;
int motorPin3 = 10;