Skip to content

Instantly share code, notes, and snippets.

@go-ive
go-ive / ChainReaction.java
Created September 17, 2013 13:39
Reddit DailyProgrammer Challenge #133 - Chain Reaction
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;
import java.util.Set;
public class ChainReaction {
static int stepCount = 0;
@go-ive
go-ive / diceroll.go
Created September 17, 2013 13:43
Reddit DailyProgrammer Challenge #130 - Roll the Dies
package main
import (
"fmt"
"regexp"
"os"
"log"
"strings"
"strconv"
"math/rand"
@go-ive
go-ive / string-transposition.go
Last active December 23, 2015 06:29
Reddit DailyProgrammer Challenge #137 - String Transposition
package main
import (
"fmt"
)
func main() {
var numLines int
fmt.Scanf("%d", &numLines)
@go-ive
go-ive / studentmanagement.py
Created September 17, 2013 21:09
Reddit DailyProgrammer Challenge # 136 - Student Management
nums = input().split()
num_students = int(nums[0])
num_assignments = int(nums[1])
students = []
for i in range(0, num_students):
line = input()
student_avg = sum([float(x) for x in line.split()[1:num_assignments + 1]])
students.append([line.split()[0], student_avg, student_avg / num_assignments])
@go-ive
go-ive / repulsionforce.go
Created September 19, 2013 09:31
Reddit DailyProgrammer Challenge #138 Repulsion Force
package main
import (
"bufio"
"fmt"
"math"
"os"
"strconv"
"strings"
)
package main
import (
"fmt"
"flag"
)
func main(){
tempMorning := flag.Int("morning", 60, "Temperature in the morning.")
tempAfternoon := flag.Int("afternoon", 75, "Temperature in the afternoon.")
@go-ive
go-ive / euler1.go
Created September 27, 2013 11:59
Project Euler - #1 Solution
package main
import (
"fmt"
)
func main() {
var sum int
for i := 0; i < 1000; i++ {
if i%3 == 0 || i%5 == 0 {
@go-ive
go-ive / 4chanloader.go
Created February 10, 2014 20:45
4chan image downloader in Go
package main
import (
"code.google.com/p/go.net/html"
"flag"
"fmt"
"github.com/ziutek/mymysql/mysql"
_ "github.com/ziutek/mymysql/native"
"io"
"io/ioutil"
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("Enter a number to check if it's prime:");
int possiblePrime = scanner.nextInt();
@go-ive
go-ive / dl.sh
Created August 15, 2016 21:49
YouTube DL + ffmpeg mp3 downloader script
#!/bin/bash
readonly TMP_DIR="/tmp/ytdl"
readonly TMP_OUT="/tmp/out"
readonly ARGS="$@"
download_video() {
echo "================================ Downloading $1 ================================"
youtube-dl $1 --output ${TMP_DIR}/%\(title\)s
}