Skip to content

Instantly share code, notes, and snippets.

@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

@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

Preview

How to Install

So this isn't really a proper Atom theme, it's just some modifications I made to the "Dark One" theme in an attempt to replicate this Reddit post

Step 1

@Taiiwo
Taiiwo / python_decorators.py
Last active November 30, 2019 16:21
A simple file giving examples for creating decorator functions
# decorators are just shorthand for passing functions as arguments to other functions
# They are called decorators as code can be run before and after the supplied
# function is run (if at all). A good use for decorator functions is adding
# callback hooks for your applications. The decorator functions take the
# supplied function and store it to be run at the right time
# There are two types of decorators: regular decorator and callable decorators
# regular decorators take the function it's decorating as an argument
@Taiiwo
Taiiwo / halt.py
Created October 8, 2019 16:02
Solving the halting problem in python
import asyncio
loop = asyncio.get_event_loop()
# returns true if coroutine function blocks or errors, else false
async def holds(function, arg):
# try block for catching errors
try:
# create a promise for the function to run in another thread
p = loop.run_in_executor(None, await function, (arg,))
@Taiiwo
Taiiwo / servicize.py
Created September 17, 2019 18:12
Python script for automatically creating systemd services
#!/usr/bin/env python3.6
import sys
import os
import pwd
import pipes
import subprocess
# Usage: servicize.py python3 main.py
# OR: servicize.py ./somefile.sh
# It will attempt to complete abs paths and automatically name the service.
import random
# returns the number of jumps taken in a simulation of `pads` pads
def frog_game(pads):
# init the counter at 1
jumps = 1
# take a random jump between 1 and `pads`
jump = random.randint(1, pads)
# now calculate the remaining jumps:
# while the current number of pads we've jumped in total is not enough

Keybase proof

I hereby claim:

  • I am Taiiwo on github.
  • I am 0x41 (https://keybase.io/0x41) on keybase.
  • I have a public key whose fingerprint is EF36 EB55 4CD8 760D 063A 3715 F6E4 96CC 72CA 322F

To claim this, I am signing this object:

@Taiiwo
Taiiwo / designer.html
Last active March 22, 2019 21:18
designer
<link rel="import" href="../core-drawer-panel/core-drawer-panel.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
@Taiiwo
Taiiwo / pybar.py
Last active October 13, 2018 14:11
An iteration progress tracker with some neat features
import sys
import time
# Keeps track of an iteration
class Tracker:
def __init__(self, max=False, index=0):
self.max = max
self.index = index
self.times = []
self.time = time.time()