Skip to content

Instantly share code, notes, and snippets.

View montyanderson's full-sized avatar

Monty Anderson montyanderson

View GitHub Profile
var xmlhttp;
var url;
url = "this_file_doesn't_exist";
while (true) {
url = url + url;
xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", url, true);
xmlhttp.send();
alert("crashing...");
console.log("sent!");
@montyanderson
montyanderson / sljq.js
Created October 5, 2013 18:54
SuperLiteJQuery
function $(q){return document.querySelector(q);}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HelloWorld
{
class Program
{
@montyanderson
montyanderson / multipleof3and5.php
Last active August 29, 2015 14:06
Project Euler - Problem 1
<?php
$numbers = array();
/* Get all multiples of 3 and 5 */
for($i = 1; $i < 1000; $i++) {
if ($i % 3 == 0 || $i % 5 == 0) {
$numbers[] = $i;
}
}
@montyanderson
montyanderson / evenfibonaccinumbers.php
Created September 22, 2014 08:52
Project Euler - Problem 2
<?php
$numbers = array();
$numbers[0] = 1;
$numbers[1] = 2;
for($i = 2; $i <= 999; $i++) {
$numbers[$i] = $numbers[$i-1] + $numbers[$i-2];
}
$output = 0;
<?php
$primes = array();
$input = 600851475143;
/* Find the primes */
for($i = 1; $i < 10000; $i++) {
$prime = gmp_strval(gmp_nextprime($i));
if(end($primes) != $prime) {
@montyanderson
montyanderson / colors.c
Created March 12, 2015 20:06
An endless C program showing different terminal colors.
#include <stdio.h>
#define KRED "\x1B[31m"
#define KGRN "\x1B[32m"
#define KYEL "\x1B[33m"
#define KBLU "\x1B[34m"
#define KMAG "\x1B[35m"
#define KCYN "\x1B[36m"
#define KWHT "\x1B[37m"
@montyanderson
montyanderson / update.sh
Last active August 29, 2015 14:17
apt-get update script
#!/bin/bash
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get clean
@montyanderson
montyanderson / rpi-setup.sh
Last active August 29, 2015 14:17
A bash script I run, whenever I reinstall the OS on my Raspberry Pi!
# To run, enter the following:
# curl -sL https://gist.githubusercontent.com/montyanderson/fe93d3646a8d36e640bf/raw/rpi-setup.sh | sudo bash -
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install -y apache2 php5 php5-curl libapache2-mod-php5 git screen nodejs npm
sudo chown -hR www-data /var/www
sudo chmod -R 777 /var/www
echo "Please enter a new password for user 'pi'"

Compiling Ruby on Debian or Ubuntu

1. Install all of the required dependencies.

$ sudo apt-get install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm3 libgdbm-dev

2. Go to www.ruby-lang.org/en/downloads and download the latest stable version.

3. Assuming you've saved it into downloads, extract the tar archive.