Skip to content

Instantly share code, notes, and snippets.

View JSeam2's full-sized avatar

Jseam JSeam2

View GitHub Profile
@JSeam2
JSeam2 / Winning.py
Last active February 10, 2017 14:56
Check if you won Spool's toto. A simple script to reduce hassle
def any_win(win_num, additional, my_num):
"""
Check if there's a win
:param win_num: the winning numbers (list of int)
:param addtional: additional number (int)
:param my_num: my numbers (list of int)
:return: Top Category of Win or No Win (str)
"""
# temporary list
@JSeam2
JSeam2 / Keybase.md
Created June 30, 2017 09:22
Keybase stuff

Keybase proof

I hereby claim:

  • I am jseam2 on github.
  • I am jseam (https://keybase.io/jseam) on keybase.
  • I have a public key whose fingerprint is E9EA 85C8 0452 7CF0 3A09 BFAA BEFB D1C8 CCCF E445

To claim this, I am signing this object:

@JSeam2
JSeam2 / Hail.java
Created September 12, 2017 01:44
Javascript for hail
import java.util.ArrayList;
public class Hailstone{
public static void main(String[] args){
System.out.println(Hail(3));
}
public static ArrayList Hail(int n){
ArrayList<Integer> HS = new ArrayList<Integer>();
HS.add(n);
@JSeam2
JSeam2 / fact.py
Created November 21, 2017 04:50
Dynamic Programing Factorial Calculation.
# -*- coding: utf-8 -*-
"""
no difference
"""
import time
import matplotlib.pyplot as plt
table = {0:1}
def fact1(n):
if n in table:
@JSeam2
JSeam2 / fibiter.py
Created November 21, 2017 05:34
Calculate Fibonacci Sequence Iteratively w/ and w/o memoization
"""
fib iterative version
with memoization
"""
def fib(n):
a, b = 0, 1
for x in range(1, n + 1):
a, b = b, a+b
return a
@JSeam2
JSeam2 / pdf_edit.py
Created February 1, 2018 18:00
Add file name to the bottom of pdf page using python
"""
Add file name to the bottom of pdf page using python
"""
from PyPDF2 import PdfFileWriter, PdfFileReader
import io
from reportlab.pdfgen import canvas
from reportlab.lib.pagesizes import letter
import os
import sys
@JSeam2
JSeam2 / complex.c
Created February 8, 2018 15:24
Adding Complex Numbers in C
/*
* =====================================================================================
*
* Filename: complex.c
*
* Description: Implementation of program that supports accepting two complex numbers from the user; adding, subtracting, multiplying, and dividing them; reporting each result to the user
*
* Version: 1.0
* Created: 02/08/2018 10:12:01 PM
* Revision: none
@JSeam2
JSeam2 / prob_test.py
Created February 9, 2018 17:59
Using an unbiased 6 sided die What is the probability that you will roll a 4 at least once if you roll six times?
import random
"""
Using an unbiased 6 sided die
What is the probability that you will roll a 4 at
least once if you roll six times?
P(At Least a 4) = P(Total) - P(Not a 4)^6
P(At Least a 4) = 1 - (5/6)^6
@JSeam2
JSeam2 / calculator_grammar.py
Created March 20, 2018 14:27
Generate Inputs to a calculator according to a specified grammar
import random
# As the grammar doesn't handle divide by 0, such functions cannot be evaluated
# properly
def calculator(input_string):
"""
Input a string with valid grammer to calculate result
We will use the following grammar
@JSeam2
JSeam2 / workbookcrack.vb
Created June 6, 2018 02:47
Crack Protected Excel Workbooks
Sub PasswordBreaker()
Dim i As Integer, j As Integer, k As Integer
Dim l As Integer, m As Integer, n As Integer
Dim i1 As Integer, i2 As Integer, i3 As Integer
Dim i4 As Integer, i5 As Integer, i6 As Integer
On Error Resume Next
For i = 65 To 66: For j = 65 To 66: For k = 65 To 66