Skip to content

Instantly share code, notes, and snippets.

View JosephRedfern's full-sized avatar

Joseph Redfern JosephRedfern

View GitHub Profile
@JosephRedfern
JosephRedfern / Speedtest
Last active September 16, 2015 21:35
Scaleway ARM machine
root@beryllium:~# wget http://cachefly.cachefly.net/100mb.test
converted 'http://cachefly.cachefly.net/100mb.test' (ANSI_X3.4-1968) -> 'http://cachefly.cachefly.net/100mb.test' (UTF-8)
--2015-09-03 11:28:49-- http://cachefly.cachefly.net/100mb.test
Resolving cachefly.cachefly.net (cachefly.cachefly.net)... 62.210.187.96
Connecting to cachefly.cachefly.net (cachefly.cachefly.net)|62.210.187.96|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 104857600 (100M) [application/octet-stream]
Saving to: '100mb.test'
100mb.test 100%[==========================================================================================================================================>] 100.00M 50.1MB/s in 2.0s
public class JoesJavaCoursework{
public static void main(String[] args){
new JoesJavaCoursework();
}
public JoesJavaCoursework(){
this.lolbox();
}
public void lolbox(){
@JosephRedfern
JosephRedfern / gist:2776271
Created May 23, 2012 16:39
cPanel public_html backup extractor
#!/bin/bash
#This script assumes that your cPanel backup tarball is in the same directory as your public_html folder
#It doesn't do any verification, and will just quit if something goes wrong (due to set -e).
#Use at your own risk!
set -e
echo "Extracting Backup! If you dont see the message: All done!, then something has gone wrong."
cd $1
tar -xf back*
@JosephRedfern
JosephRedfern / gist:2956289
Created June 19, 2012 20:17
OS X Applications
  • Office 2011
  • Photoshop
  • TextMate
  • Google Chrome (or Chromium?)
  • Alfred
  • VLC Media Player
  • Twitter Client
  • Eclipse
  • Dropbox
  • Sparrow
@JosephRedfern
JosephRedfern / gist:3137970
Created July 18, 2012 18:40
Grade Workerouterer
modules = {"cm1101":0.0, "cm1102":0.0, "cm1103":0.0, "cm1201":0.0, "cm1202":0.0, "cm1203":0.0, "cm1205":0.0}
for module in modules:
modules[module]=float(raw_input("Grade for "+module+": "))
print "Overall Grade: "+str((20*(modules["cm1101"]+modules["cm1102"]+modules["cm1103"]+modules["cm1202"]+modules["cm1203"])+10*(modules["cm1201"]+modules["cm1205"]))/120.0)
@JosephRedfern
JosephRedfern / gist:3843353
Created October 6, 2012 01:18
Thermistor Read Function
//a = analog reading, b = formula paramater (beta value of thermistor), r = reference resistance, t = reference temperature, z = resistance of static resistor in potential divider circuit, vin = input voltage.
double ntcTemp(double a, double b, double r, double t, double z, double vin){
double vout = (vin*a)/1023.0;
double resistance = z/((vin)/(vout)-1);
return 1/((log(resistance/r)/b)+(1/t))-273.15;
}
@JosephRedfern
JosephRedfern / gist:3912286
Created October 18, 2012 14:37
Word Value
import string
abc = string.lowercase
def calcword():
word = raw_input("Enter Word: ")
value = 0
for char in word:
value += abc.index(char.lower())+1
@JosephRedfern
JosephRedfern / 1. DecompilationTest.java
Last active December 1, 2015 16:42
dx variable name destruction
import java.util.Scanner;
public class DecompilationTest{
public int SomeField = 123;
public static void main(String args[]){
DecompilationTest dt = new DecompilationTest();
dt.SomeMethod();
}
@JosephRedfern
JosephRedfern / addsite.sh
Created January 28, 2013 15:35
Nginx Site Aded
#!/bin/bash
#path to folder containing folders referenced by nginx server blocks
SERVERPATH="/var/www"
#name of logs folder
LOGFOLDER="logs"
#name of www folder (i.e. folder where web files are held)
WWWFOLDER="public_html"
"Enable Vundle
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
"Vundles! Wo0oho0o!
Bundle 'gmarik/vundle'
Bundle 'kien/ctrlp.vim'
Bundle 'altercation/vim-colors-solarized'
Bundle 'vim-scripts/JavaScript-Indent'
Bundle 'jcf/vim-latex'