Skip to content

Instantly share code, notes, and snippets.

@Taiiwo
Taiiwo / logprimethread.py
Last active December 24, 2015 20:19
A python script that will find all prime numbers between 2 numbers. Bugs: Won't find primes under 11. Does some extra checking and needs to be sped up.
import sys, thread, time
# define some settings
threads = 4
logname = "log.log"
def getprimes(rangemin, rangemax, log): # This function returns all primes between
# rangemin and rangemax, and puts them into log
if rangemin % 2 == 0: # if number is divisible by 2
rangemin += 1 #make odd
while rangemin < rangemax: #make sure we don't search over the specified number
@Taiiwo
Taiiwo / numberadd.html
Last active December 25, 2015 07:39
Asks for 10 numbers, then adds them together.
<script>
var num = [];
var total = 0;
for (var i = 0; i < 10; i++) {// for i as each number between 0 and 9:
num.push(parseInt(prompt()));// ask for a number
}
for (i=0; i < num.length; i++){// for i as each number in num.length:
total += num[i];// total equals itself plus the current number in num
}
</script>
@Taiiwo
Taiiwo / UltimatelyMinimalistGuidetoPython.md
Last active September 16, 2021 15:23
Taiiwo's Ultimately Minimalist Guide to Python

Taiiwo's Ultimately Minimalist Guide to Python

This link is refferenced all the time. Keep it open in tab. http://docs.python.org/2/reference/

The numbers before each section refer to this document. Use it to get more detail on a subject.

Installing

prime_count = 1
start_number = 2
number_to_check = 2
while prime_count <= 100:
result = number_to_check % start_number
if result > 0:
start_number +=1
elif result == 0:
@Taiiwo
Taiiwo / 4chansearch.py
Last active December 27, 2015 12:09
Search strings in any 4chan post. - Only views 1 thread per second to abide by the 4chan API rules (Plus a second to load the page) - Got rid of this. Bored of waiting... - Will error at the end of a search - Fixed. I forgot that threads 404. - Doesn't search thread titles - Debugging is still in there, so be prepared for a lot of output - It su…
"""Inspired by /g/sicp's bot's threadsearching module
https://github.com/gentoomen/bhottu/blob/master/modules/threadsearch.py
irc.rizon.net #/g/sicp
Search intensity added by Taiiwo - github.com/Taiiwo
Usage: python 4chansearch.py "1" 2 3/4
1: String to search for
2: Board letter
3: all: Search every reply to every thread on the board
@Taiiwo
Taiiwo / cyphcrack.py
Last active December 31, 2015 19:19
This script slowly cracks a cypher.
import urllib2
def docrypt(password):
# insert hash here
orig = "sl/iECN%22ttp%3AP%20%3Chwxh.Iw3g/TR%22.Prhl/l%201//xhtTD/D1.%20r%20anionaOsTtdxa%22/%3EmhtmlLmY%3CmwDs%20%3D%22p%3A//Dh%20twxB3T.o1999nrH/h%3ETlC%22%3E%3Chea%22mtmmea%3CXmehttpot%20%20qTlvi%3D%22tentTC/nytC%22E%20cent%3DioLtes0/-ht%20chammn%3Bem/uMtf%20/%3Emt-/%22%3C0wtole9%2033g%3E/11im0t%20311%3C/m3m9ttt%3EWmmtyleamlsy%3Ed%3D1%22t/cssoe%20tm%20n%3C%21%21-mbodn-wm%7BdwmU%09bgroula/k-0mlDor00008%3Ad%23%3Bdmmr%7Dmody%2C1m-b%2C%3Ai%20m%7Bmcolo%20m-%09%20meF3FFmmm%7D%3CF%22%3Bm%3Et%3E.mmstylxmr/%3Cb%3De/admmmmm%3Emmoii%3Ewmmiv%20acm%20dgm1%22tcer%22%3Em%20nte%20%20ep-%3E133%200m1%20%201me3t3%20%3C/p%3Em9%221mpm%3Clp%3Esp%3B%3CF%26yb%3E%3Bmm.%20%20%26nbs%3C%3Cn%3E%3Cmo%3Etmmdiv%3Emm0/mtmbmodmm%3C/%3Cytmm%3Dhmummc/F-tmrm%20%3Cpppm9mp-//pte0%20%3Cxm11tmhd%3C/%20%3C%20%20%3Etmmn%23hynl%3Ellm"
#urldeode:
orig = urllib2.unquote(orig)
# Here is the algorithm from the js
passnum = len(orig) % len(str(password))
i = 0
while i >=
@Taiiwo
Taiiwo / fpspm.py
Last active January 1, 2016 11:19
fpspm stands for Filthy Python Script Package Manager, as it build to allow the simple creation and addition of repositories containing useful python script, and a medium to run these script from anywhere, without messing up /usr/bin.
import urllib2
import sys
import json
# initialize:
## mkdir ~./fpspm
## touch ~./fpspm/local.repo
# This part is for adding things to the local repo.
# You can add:
@Taiiwo
Taiiwo / designer.html
Last active August 29, 2015 14:20
designer
<link href="../core-icon-button/core-icon-button.html" rel="import">
<link href="../core-toolbar/core-toolbar.html" rel="import">
<link href="../core-icons/core-icons.html" rel="import">
<link href="../paper-icon-button/paper-icon-button.html" rel="import">
<link href="../paper-tabs/paper-tabs.html" rel="import">
<link href="../paper-tabs/paper-tab.html" rel="import">
<link href="../core-pages/core-pages.html" rel="import">
<polymer-element name="my-element">
@Taiiwo
Taiiwo / gist:0a718f09d894553f2be2
Created July 19, 2015 18:01
A python class for verifying login details for any website
import mechanize
import cookielib
import re
class Login:
def __init__(self):
# set a bunch of properties as default settings
self.url = False
self.formIndex = 0
@Taiiwo
Taiiwo / AI.md
Last active May 26, 2023 18:42
The Basis of an Artificial Intelligence

The Basis of an Artificial Intelligence

So the general concept behind an artificial intelligence is quite simple. It's basically just a replication of what we see in other sentient beings. It has been abstracted to mean things like speech, the ability to play a game well, to guess a person's motives and intentions, and to use that against them in order to win. The reason this seems like a form of intelligence to us, a being with sentience, is because as humans, we see anything with an understanding of anything to be sentient. Almost, anyway. An understanding is a very important part, but where it really hits