Skip to content

Instantly share code, notes, and snippets.

View markph0204's full-sized avatar

Mark Hurley markph0204

View GitHub Profile
@achillesrasquinha
achillesrasquinha / popen.md
Last active April 23, 2024 06:17
A Python Popen that does not suck.

A Python Popen that does not suck.

Function

import os
import subprocess

def popen(*args, **kwargs):
    output      = kwargs.get('output', False)
    directory   = kwargs.get('dir')
@Lewiscowles1986
Lewiscowles1986 / dhcpcd.sh
Created August 21, 2017 16:00
Raspberry pi stretch allow dhcpcd5 with /etc/network/interfaces
#!/bin/sh -e
#
# This file belongs in /usr/lib/dhcpcd5/dhcpcd how you get it there is up to you
#
DHCPCD=/sbin/dhcpcd
INTERFACES=/etc/network/interfaces
REGEX="^[[:space:]]*iface[[:space:]](*.*)[[:space:]]*inet[[:space:]]*(dhcp|static)"
EXCLUDES=""
@Geek-MD
Geek-MD / qemu_osx_rpi_raspbian_jessie.sh
Last active December 30, 2020 10:51 — forked from hfreire/qemu_osx_rpi_raspbian_jessie.sh
How to emulate a Raspberry Pi (Raspbian Jessie) on Mac OSX (Sierra)
# Install Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Install QEMU OSX port with ARM support
brew install qemu
export QEMU=$(which qemu-system-arm)
# Dowload kernel and export location
brew install wget
wget https://github.com/dhruvvyas90/qemu-rpi-kernel/raw/master/kernel-qemu-4.4.34-jessie
@Lewiscowles1986
Lewiscowles1986 / rPi3-ap-setup.sh
Last active July 16, 2023 15:33
Raspberry Pi 3 access-point-setup
#!/bin/bash
#
# This version uses September 2017 august stretch image, please use this image
#
if [ "$EUID" -ne 0 ]
then echo "Must be root"
exit
fi
@jborg
jborg / gist:d50975951580c53322a0
Created February 25, 2015 12:52
xmlsec1-config: Add missing XMLSEC_NO_SIZE_T
--- /usr/bin/xmlsec1-config.orig 2015-02-25 13:47:13.384286257 +0100
+++ /usr/bin/xmlsec1-config 2015-02-25 13:46:54.849285579 +0100
@@ -199,7 +199,7 @@
#
# Assemble all the settings together
#
-the_flags="$the_flags -D__XMLSEC_FUNCTION__=__FUNCTION__ -DXMLSEC_NO_GOST=1 -DXMLSEC_NO_XKMS=1 -DXMLSEC_DL_LIBLTDL=1 -I/usr/include/xmlsec1 $the_xml_flags $the_xslt_flags $the_crypto_flags"
+the_flags="$the_flags -D__XMLSEC_FUNCTION__=__FUNCTION__ -DXMLSEC_NO_GOST=1 -DXMLSEC_NO_XKMS=1 -DXMLSEC_DL_LIBLTDL=1 -DXMLSEC_NO_SIZE_T -I/usr/include/xmlsec1 $the_xml_flags $the_xslt_flags $the_crypto_flags"
the_libs="$the_libs -L${package_libdir} -lxmlsec1 -lltdl $the_xmlsec_crypto_lib -lxmlsec1 $the_xml_libs $the_xslt_libs $the_crypto_libs"
@iamjason
iamjason / UIImage+Tinting.swift
Last active December 10, 2019 21:59
Swift UIImage extension for tinting images
/**
Usage:
let originalImage = UIImage(named: "cat")
let tintedImage = originalImage.tintWithColor(UIColor(red: 0.9, green: 0.7, blue: 0.4, alpha: 1.0))
*/
extension UIImage {
func tintWithColor(color:UIColor)->UIImage {
@natelandau
natelandau / .bash_profile
Last active March 20, 2024 22:19
Mac OSX Bash Profile
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
@wacko
wacko / gist:5577187
Last active January 6, 2024 07:31
SSH between Mac OS X host and Virtual Box guest

On Mac OS (host):

Shutdown your VM and do:

VirtualBox > Settings > Network > Add (you will get vboxnet0)

On a terminal ifconfig will show you new interface vboxnet0

VM's Settings > System > check "Enable I/O APIC." VM's Settings > Network > Adapter 2 > host-only vboxnet0

@AlanQuatermain
AlanQuatermain / gist:977280
Created May 17, 2011 20:13
A fix for a bug in -countForFetchRequest: in iOS versions prior to 4.0. If you have multiple stores at the base of your CoreData stack, it would throw an exception. The fix below swaps out the faulty version with one which directs the request at the corre
@interface NSManagedObjectContext (AQFixedCountForFetchRequestOnIOS32)
@end
@implementation NSManagedObjectContext (AQFixedCountForFetchRequestOnIOS32)
+ (void) load
{
// +load gets called per-category, unlike +initialize
if ( [[[UIDevice currentDevice] systemVersion] compare: @"4.0" options: NSNumericSearch] == NSOrderedAscending )
{
@madninja
madninja / inject_version.sh
Created February 26, 2011 19:41
Inject git version info into Info.plist and iOS settings
#!/bin/bash
cd $PROJECT_DIR
BUILD_VERSION=`/usr/local/bin/git rev-parse --short HEAD`
cd "$BUILT_PRODUCTS_DIR/$PRODUCT_NAME.app"
RELEASE_VERSION=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" Info.plist)
/usr/libexec/PlistBuddy -c "Set CFBundleVersion $BUILD_VERSION" Info.plist
/usr/libexec/PlistBuddy -c "Set :PreferenceSpecifiers:1:DefaultValue $RELEASE_VERSION ($BUILD_VERSION)" Settings.bundle/Root.plist