Skip to content

Instantly share code, notes, and snippets.

View halfvector's full-sized avatar
😄

Alex Barkan halfvector

😄
View GitHub Profile
@halfvector
halfvector / docker-ryzentosh.txt
Last active May 10, 2023 22:18
Latest Docker on Ryzentosh
# so at the time of writing, hyperkit doesn't work on AMD/Ryzen.
# this means no native docker support.
# the default docker-machine setup uses the deprecated boot2docker which is stuck with a buggy docker-19.
# i'm looking to run the latest docker daemon, have proper service-hostnames, and easy port-forwarding,
# and use the same docker-compose setups as a normal OSX/Linux machine.
# install the latest docker-host VM from https://github.com/burmilla/os/releases
# boot2docker and rancherOS are now both deprecated/unsupported.
# burmillaOS is an active fork of rancherOS.
docker-machine create -d virtualbox --virtualbox-boot2docker-url https://github.com/burmilla/os/releases/download/v1.9.0/burmillaos-v1.9.0.iso --virtualbox-memory 1500 default
@halfvector
halfvector / s3-sqs-sample.go
Created August 3, 2020 19:21
Using aws-sdk-go to pickup file changes from S3 via S3->SNS->SQS
package main
import (
"encoding/json"
"fmt"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/aws/aws-sdk-go/service/sqs"
"io/ioutil"
@halfvector
halfvector / run-datadog-osx.sh
Last active June 20, 2019 20:11
Running Datadog via Docker on OSX with APM and StatsD exposed to host
#!/bin/sh
# Don't forget to get an API key from https://app.datadoghq.com/account/settings#api
# DD_DOGSTATSD_NON_LOCAL_TRAFFIC = statsd on host even on OSX using native docker engine.
docker run -d --rm --name dd-agent \
-p 8126:8126/tcp -p 8125:8125/udp \
-v /var/run/docker.sock:/var/run/docker.sock:ro -v /proc/:/host/proc/:ro \
-e DD_API_KEY=$your_api_key_here \
-e DD_APM_ENABLED=true -e DD_APM_ENV=localhost -e DD_DOGSTATSD_NON_LOCAL_TRAFFIC=true \
datadog/agent
@halfvector
halfvector / jacocoTestReport-build.gradle
Created September 29, 2016 16:49
jacocoTestReport for unit + instrumentation test code coverage for Android
/**
* This JacocoTestReport task merges local Unit Tests and emulator/device Instrumentation Tests into a single coverage report.
* Also ignores Dagger 2 generated code.
* Add this task to your Android app/build.gradle and run your test suites then execute this task.
* Coverage report will appear in app/build/reports/jacoco/jacocoTestReport/
* as standard xml compatible with codecov.io and human readable html
* dependsOn: ['testDebugUnitTest', 'connectedDebugAndroidTest']
*/
task jacocoTestReport(type: JacocoReport) {
group = "Reporting"
@halfvector
halfvector / intellij-beautify.md
Last active January 16, 2018 20:41
Android Studio & IntelliJ Beautification

Keybase proof

I hereby claim:

  • I am halfvector on github.
  • I am unbuffered (https://keybase.io/unbuffered) on keybase.
  • I have a public key whose fingerprint is 7A4B 8DA9 C9EB 52B4 15EA DDDF BA7F EFC2 45B4 04E7

To claim this, I am signing this object:

@halfvector
halfvector / update-android-id.sh
Created July 16, 2014 17:09
update device's android_id
# prerequisites: rooted device, adb, sqlite installed locally
# works beautifully on glass
# android-ids are hexadecimal [0-9a-f]
# install sqlite3 locally to modify the db
sudo apt-get install -y sqlite3
# make sure we have a device connected
adb devices
@halfvector
halfvector / android-flat-wifi-model.java
Created March 16, 2016 16:48
Flattened Android Wifi model with Enterprise configuration extensions (EAP)
/**
* All fields are allowed to be null.
*/
class WifiConfig {
/**
* The network's SSID. Can either be an ASCII string, which must be enclosed in double quotation marks
* (e.g., "MyNetwork"), or a string of hex digits,which are not enclosed in quotes (e.g., 01a243f405).
*/
String SSID;
# a few git commands
alias gs='git status'
alias gp='git push'
alias gl='git log --graph --pretty=tformat:"%C(auto)%h%Creset - %s %Cgreen(%cr) %C(bold blue)<%an>%Creset %C(auto)%d%Creset" --abbrev-commit'
alias cdiff='cdiff -s -c always | less -rFX'
# recent log entries without a pager
alias glr='git --no-pager log -25 --graph --pretty=tformat:"%C(auto)%h%Creset - %s %Cgreen(%cr) %C(bold blue)<%an>%Creset %C(auto)%d%Creset" --abbrev-commit'
alias gs='git status -s'
@halfvector
halfvector / docker-purge-containers.sh
Created March 25, 2015 13:50
Cleanup exited Docker containers to free up disk space
#!/bin/sh
echo "Removing exited docker containers.."
docker ps -f status=exited -q | xargs docker rm