Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Roger TJRoger

🎯
Focusing
View GitHub Profile
@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
View xcode-build-number-generator.sh
#!/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"
View pip2.swift
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
View TupleToArray.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
View hello_world.py
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
View gist:d4be65e874404ae53acaf020387c8762

1. Clone your fork:

git clone git@github.com: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
View GLSL-Noise.md

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);
}
View netsetup.sh
#!/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
View update.sh
#!/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
@TJRoger
TJRoger / ps.sh
Created September 14, 2016 07:35
View ps.sh
#!/bin/bash
cd /home/
if [ $1 ]; then
for d in */ ; do
user=${d%/*}
echo $user;
#ps aux |grep router.php |grep $user |wc -l
ps aux |grep $1 |grep $user |wc -l
done
else