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 logging | |
import socket | |
import SocketServer | |
import sys | |
import time | |
import threading | |
from ftplib import FTP | |
from os import listdir, remove, rename, stat | |
from os.path import isfile, join, splitext, isfile |
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 math | |
import numpy as np | |
def createDataSet(): | |
""" | |
Creates a basic data set labels. | |
The labels are the classification given to the points. The data | |
is hardcoded in this toy example. |
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
// Constants | |
const test_const = 1; | |
// Scoped variables - use `let` for local scope | |
let callbacks = []; | |
for (let i = 0; i < 3; ++i) { | |
callbacks[i] = function() { return i; }; | |
} | |
// Arrow functions |
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 | |
rm -rf out | |
mkdir out | |
for d in $(ls) | |
do | |
if [[ $d == *.jpg ]] | |
then | |
convert $d "out/$d.png" |
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
// Fisher-Yates Shuffle | |
var shuffle = function(list_in) { | |
var pick, temp; | |
var list = list_in.slice(0); | |
var i = list.length; | |
while (--i > 0) { | |
pick = Math.floor(Math.random() * i); | |
temp = list[i]; | |
list[i] = list[pick]; | |
list[pick] = temp; |
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
# Create a numpy array from a list | |
data = np.array(listData) | |
# Get a vector of elements in 2nd column -> [1, 2, 3] | |
# Remeber that the arrays are 0 indexed so technically it would be the 3rd column | |
colVec = data[:,2] | |
# Get a vector of elements 1st row -> [1, 2, 3] | |
# Don't forget the comma! | |
rowVec = data[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
import time | |
import MySQLdb as mdb | |
from warnings import filterwarnings | |
import config | |
filterwarnings('ignore', category = mdb.Warning) | |
conn = mdb.connect(*config.db) |
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
javac -classpath /full/path/to/file.jar -d class/output/dir src/*.java | |
jar -cvf outdir/program.jar -C class/output/dir/ . |
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
# Need this installed to use `add-apt-repository` | |
sudo apt-get install python-software-properties | |
sudo add-apt-repository ppa:webupd8team/java | |
sudo apt-get update | |
sudo apt-get install oracle-java7-installer | |
sudo update-java-alternatives -s java-7-oracle | |
# Download and install Hadoop 1.1 from one of the mirrors. | |
wget http://apache.mirrors.tds.net/hadoop/common/hadoop-1.1.2/hadoop_1.1.2-1_x86_64.deb |
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
sudo mount -t nfs -o resvport,soft,intr,rsize=8192,wsize=8192,timeo=900,retrans=3,proto=tcp hostname:/shared_dir /local_dir |