Skip to content

Instantly share code, notes, and snippets.

View jonaslsaa's full-sized avatar

Jonas jonaslsaa

View GitHub Profile
@jonaslsaa
jonaslsaa / web_crawler.py
Created February 1, 2016 23:57
Web Crawler. NEEDS bs4 installed!
import requests
from bs4 import BeautifulSoup #NEEDS bs4 installed!
def trade_spider(max_page):
page = 1
while page <= max_page:
url = "http://www.finn.no/finn/realestate/homes/result?location=0%2F20061&page=" + str(page)
source_code = requests.get(url)
plain_text = source_code.text
@jonaslsaa
jonaslsaa / telnetserver.py
Created December 25, 2015 11:22
Python Socket Telnet Chat Room (Python 3.5.1)
import socket
import sys
from _thread import *
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
clients = []
host = ''
port = 23
chat = ""
print("\n"*50)
@jonaslsaa
jonaslsaa / Terrain_Generation.pde
Created July 3, 2015 09:57
Random Terrain Generation in Java (Processing)
int windowX = 800; //Default 800 X 600
int windowY = 600;
int[] terrain = new int[windowX];
int count = 2;
int start;
int temp_z;
void setup(){
background(0,0,0);
frameRate(10000);
@jonaslsaa
jonaslsaa / Double_Bubble_Sorting.pde
Created July 2, 2015 12:21
Double Bubble Sorting
int windowX = 800; //Default 800 X 600
int windowY = 600;
int swaps = 0;
int[] stack = new int[windowX]; // P-1
String algorithm = "Double Bubble Sorting";
int passes = 0;
boolean passed = false;
int counter = 1;
int temp;
@jonaslsaa
jonaslsaa / Bubble_Sorting.pde
Last active August 29, 2015 14:24
Bubble Sorting mad ein Processing, VOX 2015
int windowX = 800; //Default 800 X 600
int windowY = 600;
int swaps = 0;
int[] stack = new int[windowX];
String algorithm = "Bubble Sorting";
int passes = 0;
boolean passed = false;
int counter = 1;
int temp;
int old_swaps;
void keyPressed() { //Controls
//println(keyCode);
if (key == CODED) {
if (keyCode == UP) {
direction = "up";
accelerate = true;
} if (keyCode == DOWN) {
direction = "down";
@jonaslsaa
jonaslsaa / 1pastebot.py
Last active November 19, 2021 23:45
PasteBin Bot with Pastebin API 1.6
#Python 3.4
import random
import string
import time
from pastebin import PastebinAPI
x = PastebinAPI()
DEV_KEY1 = '475b38cdfbba7a92d8bde6c56adfb241' #primary key
@jonaslsaa
jonaslsaa / name_gen.py
Created May 25, 2015 12:21
Name Fetcher 1.2
#Python 3.4
import requests
from bs4 import BeautifulSoup
def spider(max_refresh):
file = open("names_generated.txt","w")
file.close()
file = open("names_generated.txt","a")
@jonaslsaa
jonaslsaa / SchoolSystem.py
Created May 25, 2015 12:19
School System Official Release 2.4
#Python 3.4
import pickle
pupil = []
def menu():
print("\n*****************CLASS REGISTER*****************")
print("Press 1 See The List Of Pupils")
print("Press 2 To Add New Pupils")
print("Press 3 To Remove Pupils")
@jonaslsaa
jonaslsaa / boot.py
Created May 3, 2015 16:58
Python OS - Command Line Interface Operating System (needs an folder named 'usr' in same directory)
# -*- coding: utf-8 -*-
print("Loading OS...")
from datetime import datetime
import os
import re
import sys
import cl_apps
current_time = datetime.now().time()