Skip to content

Instantly share code, notes, and snippets.

View robinnorth's full-sized avatar
:octocat:

Robin North robinnorth

:octocat:
View GitHub Profile
@robinnorth
robinnorth / Detect.cs
Last active September 11, 2018 16:30
Detect Vive/Oculus usage with SteamVR
// From https://steamcommunity.com/app/358720/discussions/0/343787283754448603/?ctp=2#c1326718197205185044
bool BIsHTCViveController()
{
System.Text.StringBuilder sbType = new System.Text.StringBuilder(1000);
Valve.VR.ETrackedPropertyError err = Valve.VR.ETrackedPropertyError.TrackedProp_Success;
SteamVR.instance.hmd.GetStringTrackedDeviceProperty((uint)trackedObj.index, Valve.VR.ETrackedDeviceProperty.Prop_ManufacturerName_String, sbType, 1000, ref err);
return ( err == Valve.VR.ETrackedPropertyError.TrackedProp_Success && sbType.ToString().StartsWith("HTC") );
}
@robinnorth
robinnorth / server-to-server-scp.sh
Last active November 24, 2017 10:43
Server to server SCP files
scp -rv <user>@<remote_host>:<remote_source_path>* <local_target_path>
@robinnorth
robinnorth / ip-up
Created December 14, 2016 16:35 — forked from p120ph37/ip-up
PPP VPN split-network/split-DNS script for OSX
#!/bin/sh
####################################################
## ##
## PPP VPN split-network/split-DNS script for OSX ##
## by Aaron Meriwether ##
## ##
## installation: ##
## sudo cp thisfile /etc/ppp/ip-up ##
## sudo chmod 755 /etc/ppp/ip-up ##
## ##
@robinnorth
robinnorth / reset-ios-simulators.sh
Created December 13, 2016 11:10
Reset iOS Simulators to default
#!/bin/bash
# Kill any running Xcode or CoreSimulator processes
killall Xcode
sudo killall -9 com.apple.CoreSimulator.CoreSimulatorService
# Remove existing simulators, including any installed apps
rm -rf ~/Library/Developer/CoreSimulator/Devices
# Recreate available devices and simulators to correspond to iOS runtime bundled with installed Xcode version and any additionally-installed runtimes
open /Applications/Xcode.app
# List available devices (in /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/CoreSimulator/Profiles
#!/bin/bash
# Uninstall node.js
#
# Options:
#
# -d Actually delete files, otherwise the script just _prints_ a command to delete.
# -p Installation prefix. Default /usr/local
# -f BOM file. Default /var/db/receipts/org.nodejs.pkg.bom
<?php
/**
* Create ACF setting page under Events CPT menu
*
* @since 1.0.0
*/
if ( function_exists( 'acf_add_options_sub_page' ) ){
acf_add_options_sub_page(array(
'title' => 'Event Settings',
'parent' => 'edit.php?post_type=events',
DB="your_database_name"
USER="your_db_user"
PASS="your_db_pass"
HOST="database_hostname"
(
echo 'ALTER DATABASE `'"$DB"'` CHARACTER SET utf8 COLLATE utf8_general_ci;'
mysql -p $PASS -u $USER -h $HOST "$DB" -e "SHOW TABLES" --batch --skip-column-names \
| xargs -I{} echo 'ALTER TABLE `'{}'` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;'
) \
| mysql -p $PASS -u $USER -h $HOST "$DB"
@robinnorth
robinnorth / node_chown-global-modules.sh
Created May 15, 2014 08:01
Changes ownership of global `node_modules` directory to current user on OS X
sudo chown -R `whoami` /usr/local/lib/node_modules
@robinnorth
robinnorth / git_remove-ignored-files.sh
Last active February 21, 2018 16:24
Git: Remove all files ignored by .gitignore from repository
git rm -r --cached .
git add .
git commit -m 'Removed all files that are in the .gitignore'
@robinnorth
robinnorth / bash_wget-mirror-website.sh
Created May 17, 2013 15:32
Bash: Create a static mirror of a website using wget
$ wget --mirror --no-parent --adjust-extension --restrict-file-names=windows --convert-links --page-requisites --verbose --directory-prefix=/home/user/path http://www.example.com/