Skip to content

Instantly share code, notes, and snippets.

View BytesAndCoffee's full-sized avatar

Michael Yazdani BytesAndCoffee

View GitHub Profile
#!/bin/bash
# Change the path to your desired directory
directory="/home/michael/Pictures/Screenshots"
# Function to process the screenshots
process_screenshot() {
path=$1
file=$2
url=$(/home/michael/bin/hepgg "$path/$file")
from dataclasses import dataclass, field
from typing import List, Union
@dataclass
class Node:
group: str
num: str
peers: List['Node'] = field(default_factory=list)
routes: List['Route'] = field(default_factory=list)
from sqlalchemy import Column, Integer, String, DateTime
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class Line(Base):
__tablename__ = 'logs'
id = Column(Integer, primary_key=True)
#!/bin/bash
cd /mnt/c/Users/Michael
./ictl.ps1 $(~/tools/ictl.py $1)
#!/usr/bin/python3
from sys import argv
print({"play": 0, "pause": 1, "next": 2, "prev": 3}[argv[1]])
#!/mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe
if ((Get-Process itunes -ea SilentlyContinue) -eq $Null) {'{"error": "iTunes: not running"}'
}
else {
$itunes = New-Object -ComObject itunes.application
$ctl = {$itunes.Play()},{$itunes.Pause()},{$itunes.NextTrack()},{$itunes.PreviousTrack()}
& $ctl[$args[0]]
}
@BytesAndCoffee
BytesAndCoffee / index.py
Last active October 27, 2017 14:30
PHTML: Python HTML framework using a flat, modular layout
#!/usr/bin/python3.6
from bottle import route, run
import phtml as p
from html import escape
page = p.Grid('page')
header = p.Element(
'div',
from random import shuffle
serial = [n for n in range(15)]
shuffle(serial)
class Node:
def __init__(self, parent, val):
self.parent = parent
// ==UserScript==
// @name My Fancy New Userscript
// @version 0.1
// @match http://www.okcupid.com/*
// @copyright 2012+, Yazdmich
// @require http://code.jquery.com/jquery-1.10.2.js
// @require http://code.jquery.com/ui/1.11.2/jquery-ui.js
// ==/UserScript==
this.$ = this.jQuery = jQuery.noConflict(true);
function httpGet(theUrl) {
@BytesAndCoffee
BytesAndCoffee / Assembler.py
Last active August 29, 2015 14:10
Portfolio
import ram
jumps = {'JMP': 'C0',
'JZ': 'C1',
'JNZ': 'C2',
'JS': 'C3',
'JNS': 'C4',
'JO': 'C5',
'JNO': 'C6'}
table = {