Skip to content

Instantly share code, notes, and snippets.

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 / 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()
@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 / README.md
Last active September 7, 2017 07:13

Weechat Catchup Script

A weechat script that catches you up to the chat using RSVP(Rapid serial visual presentation); a statistically proven way of scanning text with higher speeds and retention rate than regular reading.

There are many apps and services out there that let you read articles, text files, and other media using a method of RSVP, but none of them are really convenient for reading IRC messages. I found that if it takes me too long to

@Taiiwo
Taiiwo / README.md
Last active September 27, 2016 21:10
Sorts a list of sizes into min number of groups, where each group has a maximum size

I wrote this to help me to estimate the number of planks of wood I would need to build some furniture (The measurements of that furniture can still be found in the code). It has many uses. Obviously it can be used for splitting any material of a given length into an array of sizes in an efficient way, but it can also be used for other group sorting problems like fitting groups of people into, busses, or hotel rooms etc.

It's not the fastest solution, it just calculates all possible combinations, nor is it perfectly accurate as it just creates a list of the most efficient groups that can be made in order, but it's a pretty good solution for its application, which only needs to answer the question: How many planks of wood do I need?