Skip to content

Instantly share code, notes, and snippets.

View TJRoger's full-sized avatar
🎯
Focusing

Roger TJRoger

🎯
Focusing
View GitHub Profile
@TJRoger
TJRoger / clean_symlinks.sh
Created September 11, 2023 02:52
Remove all symlinks for which the previously linked file location no longer exists.
@TJRoger
TJRoger / xcode-build-number-generator.sh
Last active May 23, 2022 11:24 — forked from daegren/xcode-build-number-generator.sh
Script to automatically set the build number to the date
#!/bin/sh
# xcode-build-number-generator.sh
# @desc Automaticvally create build number every time using curent day, month and year
# @usage
# 1. Select: your Target in Xcode
# 2. Select: Build Phases Tab
# 3. Select: Add Build Phase -> Add Run Script
# 4. Paste code below in to new "Run Script" section
# 5. Drag the "Run Script" below "Link Binaries With Libraries"
import UIKit
import AVFoundation
import AVKit
class ViewController: UIViewController, AVPlayerViewControllerDelegate {
var playerController : AVPlayerViewController!
override func viewDidLoad() {
super.viewDidLoad()
@TJRoger
TJRoger / TupleToArray.swift
Created July 4, 2020 09:30 — forked from emctague/TupleToArray.swift
Tuple to Array Conversion for Swift
/**
# Tuple-to-array for Swift
By Ethan McTague - January 28, 2020
This source code is in the public domain.
## Example
To convert a tuple of Ints into an array of ints:
We couldn’t find that file to show.
@TJRoger
TJRoger / hello_world.py
Created February 27, 2020 13:11
Hello World Examples
class HelloWorld:
def __init__(self, name):
self.name = name.capitalize()
def sayHi(self):
print "Hello " + self.name + "!"
hello = HelloWorld("world")
hello.sayHi()
@TJRoger
TJRoger / gist:d4be65e874404ae53acaf020387c8762
Created February 26, 2020 00:26 — forked from CristinaSolana/gist:1885435
Keeping a fork up to date

1. Clone your fork:

git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@TJRoger
TJRoger / GLSL-Noise.md
Created November 10, 2017 06:49 — forked from patriciogonzalezvivo/GLSL-Noise.md
GLSL Noise Algorithms

Generic 1,2,3 Noise

float rand(float n){return fract(sin(n) * 43758.5453123);}

float noise(float p){
	float fl = floor(p);
  float fc = fract(p);
	return mix(rand(fl), rand(fl + 1.0), fc);
}
#!/bin/bash
PAC="http://192.168.3.2/proxy.pac"
function networkService() {
services=$(networksetup -listnetworkserviceorder | grep 'Hardware Port')
while read line; do
sname=$(echo $line | awk -F "(, )|(: )|[)]" '{print $2}')
sdev=$(echo $line | awk -F "(, )|(: )|[)]" '{print $4}')
#echo "Current service: $sname, $sdev, $currentservice"
if [ -n "$sdev" ]; then
ifconfig $sdev 2>/dev/null | grep 'status: active' > /dev/null 2>&1
@TJRoger
TJRoger / update.sh
Created September 14, 2016 07:39
update repo automatically
#!/bin/bash
for d in */ ; do
echo 'updated '$d' at '`date +%Y-%m-%d\ %H:%M:%S` >> ~/update.log
cd $d && (git pull origin master || ``) && cd ..
done