Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@qolop
qolop / maths.rs
Created October 6, 2016 15:20
Factorization and primes
// Author: Patrick McCann
// Date: October 5, 2016
fn main() {
if std::env::args().len() > 1 {
let n = std::env::args().nth(1).unwrap().parse::<i32>().unwrap();
println!("Factors of {}: {:?}", n, factorize(n));
println!("Primes up to {}: {:?}", n, primes(n));
} else {
println!("Oops! Add the number you want to factorize as an argument.")
}
@qolop
qolop / steam_system_info.txt
Created October 3, 2016 00:02
Steam system information
Computer Information:
Manufacturer: Unknown
Model: Unknown
No Touch Input Detected
Processor Information:
CPU Vendor: GenuineIntel
CPU Brand: Intel(R) Core(TM) i5-4200U CPU @ 1.60GHz
CPU Family: 0x6
CPU Model: 0x45
@qolop
qolop / autocfg.cfg
Last active October 14, 2016 17:31
My Counter Strike: Global Offensive config. I currently play on a lower end computer.
// Higher FPS (really works)
cl_forcepreload "1"
cl_disablehtmlmotd "1"
r_drawtracers_firstperson "0"
mat_queue_mode "2"
r_eyegloss "0"
r_eyemove "0"
r_eyeshift_x "0"
r_eyeshift_y "0"
r_eyeshift_z "0"
@qolop
qolop / factors.rs
Created July 8, 2016 15:12
A one liner to find factors of a number in Rust.
use std::io;
fn main() {
println!("Enter a number to find its factors: ");
let mut s = String::new();
io::stdin()
.read_line(&mut s)
.expect("failed to read line");
let num: u64 = s.trim().parse().expect("Enter in a positive integer only");
let factors = get_factors_functional(num);
@qolop
qolop / Cargo.toml
Last active May 27, 2016 19:29
Calculates factorial of a number.
[package]
name = "factorial"
version = "0.1.0"
authors = ["qolop <mptm98@gmail.com>"]
[dependencies]
num="*"
@qolop
qolop / curr_day_name.rs
Created May 23, 2016 20:24
Get the name of the current day in Rust.
extern crate time;
fn main() {
let t = time::now();
match t.tm_wday {
0 => println!("Sunday"),
1 => println!("Monday"),
2 => println!("Tuesday"),
3 => println!("Wednesday"),
4 => println!("Thursday"),
@qolop
qolop / sphs.py
Last active June 9, 2016 18:02
update link formatting
# opens today's South Portland High School announcements in terminal/command prompt
import time
from bs4 import BeautifulSoup as clam_chowder
from urllib.request import urlopen
def main():
dt1 = time.strftime("%Y/%m/%d")
dt2 = time.strftime("%B-%-d-%Y")
url = "http://highschool.spsd.org/riots/{}/{}/".format(dt1, dt2).lower()
print(url)
use std::io;
fn main() {
println!("Please input the factorial.");
let mut s = String::new();
io::stdin()
.read_line(&mut s)
@qolop
qolop / Wallvoid.lua
Created February 19, 2016 22:58
Wallvoid, a simple game made in Codea where the user must tap before the UFO exits the screen, the UFO then heading in a semi-opposite direction. http://twolivesleft.com/Codea/
--This game only works in the Codea app for iPad (which uses Lua); http://twolivesleft.com/Codea/
--This code was originally made in April 2014.
function setup()
score = 0
hit = 0
x=380 --starting x
y=400 --starting y
d=100 --diameter of ball
dx = 0
dy = 0