Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:

Robin North robinnorth

:octocat:
View GitHub Profile
@robinnorth
robinnorth / Detect.cs
Last active Sep 11, 2018
Detect Vive/Oculus usage with SteamVR
View Detect.cs
// 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 Nov 24, 2017
Server to server SCP files
View server-to-server-scp.sh
scp -rv <user>@<remote_host>:<remote_source_path>* <local_target_path>
@robinnorth
robinnorth / ip-up
Created Dec 14, 2016 — forked from p120ph37/ip-up
PPP VPN split-network/split-DNS script for OSX
View ip-up
#!/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 Dec 13, 2016
Reset iOS Simulators to default
View reset-ios-simulators.sh
#!/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
View uninstall-node-osx.sh
#!/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
View wordpress_acf-options-for-cpt-archive.php
<?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',
View wordpress_utf8mb4-to-utf8.sh
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
Changes ownership of global `node_modules` directory to current user on OS X
View node_chown-global-modules.sh
sudo chown -R `whoami` /usr/local/lib/node_modules
@robinnorth
robinnorth / git_remove-ignored-files.sh
Last active Feb 21, 2018
Git: Remove all files ignored by .gitignore from repository
View git_remove-ignored-files.sh
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
Bash: Create a static mirror of a website using wget
View bash_wget-mirror-website.sh
$ wget --mirror --no-parent --adjust-extension --restrict-file-names=windows --convert-links --page-requisites --verbose --directory-prefix=/home/user/path http://www.example.com/