Skip to content

Instantly share code, notes, and snippets.

@jarhill0
jarhill0 / Cheater.java
Created November 24, 2017 05:30
Cheat for the Telegram game Lumberjack. You'll have to adapt the pixel coordinates if you want it to work.
import java.awt.*;
import java.awt.event.InputEvent;
public class Cheater {
private static final int SKY_MIN_BLUE = 250;
private static final int default_x1 = 790;
private static final int default_x2 = 950;
private static final int default_y = 292;
@jarhill0
jarhill0 / telepot_error.py
Created November 12, 2017 21:46
Telepot not playing nice with multiprocessing
import multiprocessing
import random
import time
import telepot
from telepot.loop import MessageLoop
import config
bot = telepot.Bot(config.token)
@jarhill0
jarhill0 / bf.py
Created November 6, 2017 07:42
IT WORKS
import multiprocessing
import time
class Cell:
def __init__(self):
self.left = None
self.right = None
self.value = 0
import multiprocessing
import time
def execute(code):
if code == 'S':
time.sleep(15)
print('Finished executing "{}".'.format(code))
@jarhill0
jarhill0 / bf.py
Created November 6, 2017 06:31
asyncio! agh!
import asyncio
import time
class Cell:
def __init__(self):
self.left = None
self.right = None
self.value = 0
@jarhill0
jarhill0 / bubblesort.py
Created November 5, 2017 04:36
Solving the complexity of bubblesort
class BubbleSort:
def __init__(self, items):
self.items = items
self.operations = 0
def sort(self):
while not self.sorted():
for i in range(1, len(self.items)):
self.operations += 1
a, b = self.items[i - 1:i + 1]
@jarhill0
jarhill0 / z_table.py
Last active September 1, 2017 03:50
For use as a z-score table
from math import sqrt, erf, erfc
from scipy.special import erfinv, erfcinv
class Table:
def __init__(self, precision=4):
self.precision = precision
def below(self, z_score):
@jarhill0
jarhill0 / Euler014.java
Created August 31, 2017 05:14
not working (too slow!!)
import java.util.HashMap;
public class Euler014 {
private HashMap<Integer, Integer> solvedCollatz = new HashMap<>();
private Integer collatzLength(Integer start) {
Integer len = 1;
Integer num = start;
while (num != 1) {
def main():
print("I'm gonna generate a brainfuck program to print your text. It will be horribly inefficient, but it's faster",
"than writing it yourself…")
my_string = input('Enter the output string: ')
print(encode_string_to_brainfuck(my_string))
def encode_string_to_brainfuck(my_string):
import time
class Cell:
def __init__(self):
self.left = None
self.right = None
self.value = 0
def increment(self):