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
import java.math.BigInteger; | |
import java.util.stream.IntStream; | |
public class Factorial { | |
public static void main(String[] args) { | |
System.out.println(Factorial.factorial(1)); | |
System.out.println(Factorial.factorial(5)); | |
System.out.println(Factorial.factorial(120000)); | |
} |
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
function chmox | |
chmod +x $argv | |
end |
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 "https://bitbucket.org/api/2.0/repositories/{username}" | jq '.values | length') == 0 ]] |
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 | |
# Sends a Boxcar push notification through the Boxcar HTTP API | |
# Usage examples | |
# $ bc # Just sends a notification with title 'bc' | |
# $ bc "Done" # Sends a notification with title 'Done' | |
# $ echo foobar | bc # Sends a notification with title 'bc' and message body 'foobar' | |
# $ echo foobar | bc "Done" # Sends a notification with title 'Done' and message body 'foobar' | |
# | |
# Expects a file ~/.boxcar to exist with content like |
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
import co.paralleluniverse.fibers.Fiber; | |
import co.paralleluniverse.fibers.SuspendExecution; | |
import co.paralleluniverse.strands.SuspendableRunnable; | |
import co.paralleluniverse.strands.channels.Channel; | |
import co.paralleluniverse.strands.channels.Channels; | |
import jsr166e.ForkJoinPool; | |
import java.util.concurrent.ExecutionException; | |
import static java.lang.String.format; |
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
#!/usr/bin/env groovy | |
@GrabResolver("http://oss.jfrog.org/artifactory/libs-snapshot") | |
@Grab("org.ratpack-framework:ratpack-groovy:0.9.0-SNAPSHOT") | |
import static org.ratpackframework.groovy.RatpackScript.ratpack | |
ratpack { | |
handlers { | |
get { | |
response.send "Hello ratpack!" |
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 | |
set -e | |
export APP_NAME=$1 | |
export PGHOST=$(< $HOME/predeploy.d/postgres_host) | |
export PGUSER=admin | |
if [ -f $HOME/$APP_NAME/DATABASE_URL ]; then | |
# Database URL is already set - DB must exist | |
DATABASE_URL=$(cat $HOME/$APP_NAME/DATABASE_URL) |
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
for (job in Hudson.instance.items) { | |
if (! job.logRotator ) { | |
job.logRotator = new hudson.tasks.LogRotator ( 30, 40, 30, 10) // days to keep, num to keep, artifact days to keep, num to keep | |
println "$job.name edited and changed to statement below" | |
} | |
} |
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
// ==UserScript== | |
// @name Apple Dev ID team selection helper | |
// @namespace git://gist.github.com/3780792.git | |
// @version 0.1 | |
// @description Makes the select team dropdown more helpful if you have Dev and Enterprise enrolments for the same firm | |
// @match https://developer.apple.com/*/selectTeam.action | |
// @copyright 2012, Richard North | |
// ==/UserScript== | |
var options = document.getElementsByTagName("option"); |
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
worker_processes 1; | |
error_log logs/error.log; | |
events { | |
worker_connections 1024; | |
} |