This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#http://superuser.com/a/322365 | |
#lsof -t -i:4444 | |
kill `lsof -t -i:4444` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// CitizenViewController.swift | |
// citizencrossfit | |
// | |
// Created by Mark Jackson on 19/11/2014. | |
// Copyright (c) 2014 Mark Jackson. All rights reserved. | |
// | |
import UIKit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ViewController.swift | |
// VideoBackground.swift | |
// | |
// Created by Peng Jin on 25/7/14. | |
// Copyright (c) 2014 elvinjin. All rights reserved. | |
// | |
import UIKit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ViewController.swift | |
// citizencrossfit | |
// | |
// Created by Mark Jackson on 17/11/2014. | |
// Copyright (c) 2014 Mark Jackson. All rights reserved. | |
// | |
import UIKit | |
import Alamofire |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TriangleNumber { | |
private int numDivisors; | |
public TriangleNumber(int numDivisors){ //takes in how many divisors | |
this.numDivisors = numDivisors; | |
} | |
public int firstOccurance(){ //returns the first occurance of the number of divisors you want the triangle number to have | |
int i = 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class GridProduct { | |
private int[][] grid = new int[][]{ | |
{8, 02, 22, 97, 38, 15, 00, 40, 00, 75, 04, 05, 07, 78, 52, 12, 50, 77, 91, 8}, | |
{49, 49, 99, 40, 17, 81, 18, 57, 60, 87, 17, 40, 98, 43, 69, 48, 04, 56, 62, 00}, | |
{81, 49, 31, 73, 55, 79, 14, 29, 93, 71, 40, 67, 53, 88, 30, 03, 49, 13, 36, 65}, | |
{52, 70, 95, 23, 04, 60, 11, 42, 69, 24, 68, 56, 01, 32, 56, 71, 37, 02, 36, 91}, | |
{22, 31, 16, 71, 51, 67, 63, 89, 41, 92, 36, 54, 22, 40, 40, 28, 66, 33, 13, 80}, | |
{24, 47, 32, 60, 99, 03, 45, 02, 44, 75, 33, 53, 78, 36, 84, 20, 35, 17, 12, 50}, | |
{32, 98, 81, 28, 64, 23, 67, 10, 26, 38, 40, 67, 59, 54, 70, 66, 18, 38, 64, 70}, | |
{67, 26, 20, 68, 02, 62, 12, 20, 95, 63, 94, 39, 63, 8, 40, 91, 66, 49, 94, 21}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SumOfPrimes { | |
public SumOfPrimes(){ | |
System.out.println(sum(2000000)); //running the sum of primes limit to 2,000,000 [For Project Euler's answer] | |
} | |
public long sum(int limit){ //Project Euler wanted it for 2,000,000 but this method can do it for any limit given | |
boolean[] boolPrimes = new boolean[limit]; //initializing an array of booleans to the limit | |
boolPrimes[0] = false; //I know 0 isn't a prime | |
boolPrimes[1] = false;// I know 1 isn't a prime |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ #question 1 | |
'type' : 'multiple-choice', | |
'text' : | |
'Who was the first U.S. President?\n' + | |
'(1) Abraham Lincoln\n' + | |
'(2) George Washington\n' + | |
'(3) John Lennon\n' + | |
'(4) Franklin Roosevelt', |