Skip to content

Instantly share code, notes, and snippets.

View royclarkson's full-sized avatar
🍃

Roy Clarkson royclarkson

🍃
  • Broadcom
View GitHub Profile

Keybase proof

I hereby claim:

  • I am royclarkson on github.
  • I am royclarkson (https://keybase.io/royclarkson) on keybase.
  • I have a public key ASD9r6N7VGvyNv5N_mqL7OQX7lFSUjQu8HyFGZJniXsiRAo

To claim this, I am signing this object:

@royclarkson
royclarkson / tcpdump-local8080.sh
Created May 8, 2014 15:55
Bash shell command to monitor traffic on localhost port 8080
sudo tcpdump -s 0 -A -i lo0 'tcp port 8080 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)'
@royclarkson
royclarkson / start-emulators.sh
Created May 1, 2014 21:30
Bash script to start Android emulators based on the array of specified API levels
#!/bin/bash
APIS=( 8 10 13 15 16 17 18 19 )
for API in "${APIS[@]}"; do
emulator @Android-$API -no-boot-anim &
ret=$?
if [ $ret -eq 0 ]; then
sleep 15
fi
done
sleep 15
@royclarkson
royclarkson / create-emulators.sh
Last active April 8, 2021 10:44
Bash script to create an Android emulator for each API level
#!/bin/bash
function createavd {
if [ -n "$2" ]; then
echo "no" | android create avd -n Android-$1 -t android-$1 --abi $2 --force
else
echo "no" | android create avd -n Android-$1 -t android-$1 --force
fi
}
for ((API=8; API<=19; API++)); do
android delete avd -n Android-$API
@royclarkson
royclarkson / stop-emulators.sh
Created May 1, 2014 16:14
Bash script to kill all running Android emulators
#!/bin/bash
for ((PORT=5554; PORT<=5584; PORT+=2)); do
echo killing emulator-$PORT...
adb -s emulator-$PORT emu kill
done
@royclarkson
royclarkson / gist:2512502
Created April 27, 2012 20:07
Http Basic Auth in Rest Template
HttpAuthentication authHeader = new HttpBasicAuthentication(username, password);
HttpHeaders requestHeaders = new HttpHeaders();
requestHeaders.setAuthorization(authHeader);
RestTemplate restTemplate = new RestTemplate();
ResponseEntity<Object> response = restTemplate.exchange(url, HttpMethod.GET, new HttpEntity<Object>(requestHeaders), Object.class);