Skip to content

Instantly share code, notes, and snippets.

@theonejb
theonejb / new_empty_workspace.py
Created March 31, 2021 08:17
A simple Python script to create an empty workspace in i3 using the next available number.
"""
Creates a new i3 workspace with a number one greater than the last numbered workspace. If there are no numbered workspaces, uses 1.
"""
from i3ipc import Connection
def workspace_name_to_int(name):
digits = "".join([
d for d in name if d.isdigit()
])
@theonejb
theonejb / custom_formatter_logger.py
Created March 28, 2017 22:00
Logger with custom formatter
import logging
logger = logging.getLogger("testLogger")
logger.setLevel(logging.DEBUG)
handler = logging.StreamHandler()
handler.setLevel(logging.DEBUG)
class CustomFormatter(logging.Formatter):
def format(self, record):
original_log_message = super().format(record)
@theonejb
theonejb / GrahamScan.hs
Created July 3, 2014 14:22
Grahams Scan in Haskell
-- GrahamScan.hs
-- Implements Graham's Scan algo to find the convex hull of a group of 2D points
-- http://en.wikipedia.org/wiki/Graham_scan
import GHC.Exts
import Data.List
data Point = Point {
x :: Double,
y :: Double