Skip to content

Instantly share code, notes, and snippets.

@jacks205
jacks205 / VideoBlurBackground.swift
Last active September 18, 2020 08:58
Video Blur Background in Swift
//
// ViewController.swift
// citizencrossfit
//
// Created by Mark Jackson on 17/11/2014.
// Copyright (c) 2014 Mark Jackson. All rights reserved.
//
import UIKit
import Alamofire
@jacks205
jacks205 / GifBackground.swift
Created November 19, 2014 02:40
Gif Background in Swift
//
// ViewController.swift
// VideoBackground.swift
//
// Created by Peng Jin on 25/7/14.
// Copyright (c) 2014 elvinjin. All rights reserved.
//
import UIKit
@jacks205
jacks205 / CitizenCrossfitViewController.swift
Created November 20, 2014 09:46
Basic Example of creating a SOAP request with AEXML and through a normal NSMutableURLRequest
//
// CitizenViewController.swift
// citizencrossfit
//
// Created by Mark Jackson on 19/11/2014.
// Copyright (c) 2014 Mark Jackson. All rights reserved.
//
import UIKit
@jacks205
jacks205 / process.sh
Created November 23, 2014 08:11
How to find a process on a port and kill it
#http://superuser.com/a/322365
#lsof -t -i:4444
kill `lsof -t -i:4444`
@jacks205
jacks205 / restart.sh
Last active August 29, 2015 14:10
Bash script to restart server on crash
#https://www.digitalocean.com/community/tutorials/how-to-use-a-simple-bash-script-to-restart-server-programs
#!/bin/sh
ps auxw | grep apache2 | grep -v grep > /dev/null
if [ $? != 0 ]
then
/etc/init.d/apache2 start > /dev/null
fi
@jacks205
jacks205 / launch.sh
Last active August 29, 2015 14:10
Schedules server restart script
#!/bin/bash
#NOTE: USE `bash launch` not `sh launch`
timestamp(){
(date)
}
server_name="schedules-backend"
log_file="crash_log.txt"
server_log="server_log.txt"
time=$(timestamp)
crash_message="Restarting server. Logging scripted restart. (Add successful restart log);\n"
@jacks205
jacks205 / update.sh
Last active August 29, 2015 14:10
Schedules update server script
#!/bin/bash
if [ $# -ge 2 ]
then
bash ~/launch.sh -k
if [ "$2" == "-f" ]
then
rm -r $1/
git clone https://github.com/jacks205/$1.git
cd ~/$1 && npm install
cp ~/local.js ~/$1/config/
using UnityEngine;
using System.Collections;
public class MenuCamera : MonoBehaviour {
public Transform[] cameraPositions;
public Vector2[] moveSpeeds;
public float[] cameraZoomSpeeds;
public float[] initalZoom;
public float timeAtEachPosition = 5f;
static int[] bubblesort(int[] numbers)
{
int tempVar;
for (int i = 0; i < numbers.length; i++)
{
for(int j = 0; j < numbers.length; j++)
{
if(numbers[i] > numbers[j + 1])
{
tempVar = numbers [j + 1];
@jacks205
jacks205 / palidromicNumbers.py
Created March 8, 2015 23:50
Script to find how many palindromic numbers there are in a set representable by a 16 bit unsigned integer
def main():
# length of unsigned 16 bit int
length = 65535
# keep count of how many palindromic numbers there are
count = 0
# loop through entire range
for i in range(0,length):
#cast i to a string and compare reverse
if(str(i) == reverseString(str(i))):
count += 1