Skip to content

Instantly share code, notes, and snippets.

@nathansgreen
nathansgreen / javap_output
Last active August 29, 2015 14:03
Java 8 ConcurrentHashMap.keySet() bytecode incompatibility
// In Java 8, ConcurrentHashMap backward compatibility was broken by changing to a covariant return type
Code:
0: aload_0
1: invokespecial #1 // Method java/lang/Object."<init>":()V
4: return
public static void main(java.lang.String...);
Code:
0: new #2 // class java/util/TreeSet
yum install python-devel libffi-devel openssl-devel
rpm --import https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7
yum install python-pip
@nathansgreen
nathansgreen / inst.sh
Last active November 4, 2015 19:46
Homebrew install Python 2.7.8 with SSLv2 support
cd /usr/local/Library/Formula
# remove no-ssl2 from configure options
vi openssl.rb
brew install openssl --universal
# verify support
/usr/local/opt/openssl/bin/openssl ciphers -ssl2
# I install a separate python 2.7.8 so I can switch between versions as-needed
git checkout 9c9664e -- python.rb
brew install python --universal --with-brewed-openssl
rem re-run if your system failed the upgrade compatibility check
rem if vmware's VGA driver is the problem, delete the driver, reboot, then run
schtasks.exe /Run /TN "\Microsoft\Windows\Application Experience\Microsoft Compatibility Appraiser"
@nathansgreen
nathansgreen / brewbootstrap.sh
Last active October 7, 2016 05:44
Homebrew Bootstrap
#!/usr/bin/env bash
sudo xcodebuild -license
sudo xcode-select --install
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew tap caskroom/cask
brew tap homebrew/dupes
brew tap homebrew/fuse
brew tap homebrew/headonly
@nathansgreen
nathansgreen / eb_iname.sh
Created November 16, 2016 15:41
AWS ElasticBeanstalk Instance Name
#!/usr/bin/bash
export INSTANCE_ID=$(curl http://169.254.169.254/latest/meta-data/instance-id)
export INSTANCE_NAME=$( ec2-describe-instances ${INSTANCE_ID} |grep -E "^TAG.+" |cut -f 4,5 |grep -E "^Name" |cut -f 2 )
@nathansgreen
nathansgreen / cloud-init.sh
Created December 6, 2017 15:44 — forked from ambakshi/cloud-init.sh
Amazon Linux cloud-init script
#!/bin/bash
#
# Amazon Linux cloud-init script
#
# Amit Bakshi
# 10/2014
#
if [ `id -u` -ne 0 ]; then
sudo exec /bin/bash -x "$0" "$@"
fi
@nathansgreen
nathansgreen / jq-examples.md
Last active October 26, 2018 16:10
Stuff I've had to do with jq

Simple things to do using jq

# turn a delimted string into an array:
echo '"2368;3924"' | jq 'split(";")
[
  "2368",
  "3924"
]
@nathansgreen
nathansgreen / perl-recent-version-compat.patch
Last active October 30, 2019 15:25 — forked from xywei/patch.txt
A patch for automake to compile it with later versions of Perl
Allow recent versions of Perl to compile automake.
For Yocto. Tested on poky (krogoth branch).
From https://gist.github.com/xywei/03b546054f0d2e2f76c5ac530c88268a
--- a/bin/automake.in 2015-01-06 03:25:55.000000000 +0800
+++ b/bin/automake.in 2017-07-26 13:58:07.086205701 +0800
@@ -3878,7 +3878,7 @@
sub substitute_ac_subst_variables
{
my ($text) = @_;
@nathansgreen
nathansgreen / find_iphone_uuid.sh
Created April 24, 2020 16:22
Find iPhone device UUID/UDID
#!/usr/bin/env sh
system_profiler SPUSBDataType 2>/dev/null \
| sed -n '/iPhone/,/Serial/p' \
| grep "Serial Number:" \
| awk -F ": " '{print substr($2,1,8)"-"substr($2,9,24)}'