Skip to content

Instantly share code, notes, and snippets.

@bmaupin
bmaupin / build-libimobiledevice.sh
Last active August 29, 2015 14:13
Build libimobiledevice on Ubuntu 14.04 for iOS 8 compatibility
# Edit necessary permissions
sudo chmod 777 /var/lib/lockdown
# Install dependencies
sudo apt-get -y install build-essential git libplist-dev libssl-dev libusbmuxd-dev libxml2-dev pkg-config python-dev usbmuxd
# Build libplist dependency
git clone https://github.com/libimobiledevice/libplist.git
cd libplist
./autogen.sh
@bmaupin
bmaupin / build-remmina-stable.sh
Last active August 29, 2015 14:13
Build Remmina master/stable branch on Ubuntu 14.04
# The preferred way to install a newer version of Remmina is this PPA:
# sudo apt-add-repository -y ppa:remmina-ppa-team/remmina-next
# sudo apt-get update
# sudo apt-get install -y libfreerdp-plugins-standard remmina
# Kill any running instances of Remmina
killall remmina
# Remove old Remmina packages
sudo apt-get --purge remove freerdp-x11 \
@bmaupin
bmaupin / ms-filetime.go
Created January 20, 2015 17:38
Convert MS Filetime
package main
import "fmt"
import "time"
func main() {
var filetime int64 = 129472648056962786
fmt.Println(time.Unix(convertFiletimeToUnix(filetime), 0))
}
@bmaupin
bmaupin / build-footnote.sh
Last active August 29, 2015 14:15
Build footnote on Ubuntu 14.04 64-bit
#!/bin/bash
# Install libgranite-dev 0.2 and prerequisites
wget https://launchpad.net/~elementary-os/+archive/ubuntu/stable/+files/gir1.2-granite-1.0_0.2.3.1~r662-0%2Bpkg55~ubuntu12.04.1_amd64.deb
wget https://launchpad.net/~elementary-os/+archive/ubuntu/stable/+files/libgranite-common_0.2.3.1~r662-0%2Bpkg55~ubuntu12.04.1_all.deb
wget https://launchpad.net/~elementary-os/+archive/ubuntu/stable/+files/libgranite-dev_0.2.3.1~r662-0%2Bpkg55~ubuntu12.04.1_amd64.deb
wget https://launchpad.net/~elementary-os/+archive/ubuntu/stable/+files/libgranite1_0.2.3.1~r662-0%2Bpkg55~ubuntu12.04.1_amd64.deb
sudo dpkg -i gir1.2-granite-1.0_0.2.3.1~r662-0+pkg55~ubuntu12.04.1_amd64.deb libgranite-common_0.2.3.1~r662-0+pkg55~ubuntu12.04.1_all.deb libgranite-dev_0.2.3.1~r662-0+pkg55~ubuntu12.04.1_amd64.deb libgranite1_0.2.3.1~r662-0+pkg55~ubuntu12.04.1_amd64.deb
rm gir1.2-granite-1.0_0.2.3.1~r662-0+pkg55~ubuntu12.04.1_amd64.deb libgranite-common_0.2.3.1~r662-0+pkg55~ubuntu12.04.1_all.deb libgranite-dev_0.2.3.1~r662-0+pkg55~ubuntu1
@bmaupin
bmaupin / get-ext4-start-offset.sh
Last active August 29, 2015 14:21
Get the start offset of an ext4 partition in a raw image file
LANG=C grep -aobP -m1 '\x53\xEF' system.raw.img.tmp | head -1 | awk '{print $1 - 1080}'
# Patch based on info from here:
# http://lists.freebsd.org/pipermail/freebsd-questions/2011-February/227044.html
--- configure.dist 2011-04-06 10:30:07.000000000 -0500
+++ configure 2011-04-06 11:25:17.000000000 -0500
@@ -11119,7 +11119,7 @@
# in gssapi\rfckrb5.h
#
if test "$gssapi" != "no"; then
- if test "$gss_impl" = "cybersafe" -o "$gss_impl" = "cybersafe03"; then
@bmaupin
bmaupin / sort-logs-date.py
Created January 19, 2016 19:05
Sort logs by /bin/date output
text = '''Tue Jan 19 14:00:42 EST 2016
real 0m2.491s
Sun Jan 17 21:46:41 EST 2016
real 0m15.013s
Mon Jan 18 00:49:33 EST 2016
real 0m15.039s
Sun Jan 17 23:49:16 EST 2016
real 0m15.024s
Mon Jan 18 02:50:38 EST 2016
real 0m15.020s
@bmaupin
bmaupin / build-statifier.sh
Last active February 16, 2016 17:15
Build statifier
if [ ! -f /usr/bin/statifier ]; then
wget https://sourceforge.net/projects/statifier/files/latest/download?source=files -O statifier.tgz
tar -xvf statifier.tgz
cd statifier-*
make all
sudo make install
cd ..
rm -rf statifier*
else
echo "Statifier already installed"
# Get the latest version from here: http://support.amd.com/en-us/download/desktop?os=Ubuntu+x86+64
fglrx_version=15.302
sudo dpkg --add-architecture i386
sudo apt-get install lib32gcc1 libc6-i386
wget --referer=http://support.amd.com http://www2.ati.com/drivers/linux/fglrx_$fglrx_version-0ubuntu1_amd64_ub_14.01.deb
wget --referer=http://support.amd.com http://www2.ati.com/drivers/linux/fglrx-core_$fglrx_version-0ubuntu1_amd64_ub_14.01.deb
wget --referer=http://support.amd.com http://www2.ati.com/drivers/linux/fglrx-dev_$fglrx_version-0ubuntu1_amd64_ub_14.01.deb
wget --referer=http://support.amd.com http://www2.ati.com/drivers/linux/fglrx-amdcccle_$fglrx_version-0ubuntu1_amd64_ub_14.01.deb
sudo dpkg -i fglrx*.deb
sudo apt-get update
@bmaupin
bmaupin / build-swift.sh
Last active March 12, 2017 18:49
Build Swift with Foundation on Ubuntu 14.04/16.04
# Note: the Swift binaries for Linux already include Foundation. To install them, see: https://gist.github.com/bmaupin/a1585eb29b893ac8d184
# To use Foundation, just 'import Foundation'
# If you really want to build Swift with Foundation, keep reading...
# References:
# https://github.com/apple/swift#getting-sources-for-swift-and-related-projects
# https://github.com/apple/swift-corelibs-foundation/blob/master/Docs/GettingStarted.md#on-linux
# A lot of folders will be created for dependencies, so put them all in one subfolder to keep things organized
mkdir swift-source