Skip to content

Instantly share code, notes, and snippets.

View JnyJny's full-sized avatar
👽
👽

Erik OShaughnessy JnyJny

👽
👽
View GitHub Profile
@JnyJny
JnyJny / gist:14da6be5dfb9f856efa927dfbdfb982c
Created September 5, 2018 18:35
Toyko60:JnyJny Keymap
{"keyboard":"tokyo60","keymap":"jnyjny","layout":"LAYOUT_60_hhkb","layers":[["KC_GESC","KC_1","KC_2","KC_3","KC_4","KC_5","KC_6","KC_7","KC_8","KC_9","KC_0","KC_MINS","KC_EQL","KC_BSLS","KC_GRV","KC_TAB","KC_Q","KC_W","KC_E","KC_R","KC_T","KC_Y","KC_U","KC_I","KC_O","KC_P","KC_LBRC","KC_RBRC","KC_BSPC","KC_LCTL","KC_A","KC_S","KC_D","KC_F","KC_G","KC_H","KC_J","KC_K","KC_L","KC_SCLN","KC_QUOT","KC_ENT","KC_LSFT","KC_Z","KC_X","KC_C","KC_V","KC_B","KC_N","KC_M","KC_COMM","KC_DOT","KC_SLSH","KC_LSFT","MO(1)","KC_LALT","KC_LGUI","KC_SPC","KC_RGUI","KC_RALT"],["KC_NO","KC_F1","KC_F2","KC_F3","KC_F4","KC_F5","KC_F6","KC_F7","KC_F8","KC_F9","KC_F10","KC_F11","KC_F12","KC_NO","KC_NO","KC_NO","RGB_TOG","RGB_MOD","RGB_RMOD","BL_TOGG","BL_STEP","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_UP","KC_NO","KC_NO","KC_NO","KC_VOLD","KC_MUTE","KC_VOLU","KC_NO","KC_NO","KC_NO","KC_NO","KC_HOME","KC_PGUP","KC_LEFT","KC_RGHT","KC_NO","KC_NO","KC_MPRV","KC_MPLY","KC_MNXT","KC_NO","KC_NO","KC_NO","KC_NO","KC_END","KC_PGDN","KC_DOWN
@JnyJny
JnyJny / project.py
Last active September 21, 2019 18:17
Krugg3r's Project
#!/usr/bin/env python3
from argparse import ArgumentParser
import json
import os
import requests
import sys
class ProjectNotFound(Exception):
@JnyJny
JnyJny / uptime.py
Created September 24, 2019 16:00
Python Uptime on Mac for the Masochistic
#!/usr/bin/env python3
import ctypes
import ctypes.util
from datetime import datetime
libc_path = ctypes.util.find_library("libc")
libc = ctypes.cdll.LoadLibrary(libc_path)
@JnyJny
JnyJny / manual_dump.py
Created November 12, 2019 15:57
Horrific Code to Review
import json
import os
import pathlib
from . import db, config
sponsored_id_list = config.get_sponsored()
class ProductFinder:
def get_product_details(ids=[]):
ids.extend(sponsored_id_list)
cursor = db.cursor()
cursor.execute('''
@JnyJny
JnyJny / piglet_save_png_bug.py
Last active December 19, 2019 16:32
Code for reproducing a suspected pyglet PNG saving bug.
#!/usr/bin/env python3
import pyglet
class RenderText(pyglet.window.Window):
def __init__(self, text, width=512, height=256):
super().__init__(width=width, height=height)
pyglet.gl.glClearColor(0, 0, 0, 1) # Fixes the problem.
self.document = pyglet.text.decode_text(text)
@JnyJny
JnyJny / grade_csv.py
Last active February 10, 2020 02:50
Compile Student Grades from CSV Data
#!/usr/bin/env python3
import click
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# Requirements:
# python3 -m pip install -U click pandas matplotlib numpy xlwt
@JnyJny
JnyJny / 178_comments.py
Created March 12, 2020 16:39
Comments for PyBites 178
from dateutil.parser import parse
import re
import datetime
def get_min_max_amount_of_commits(
commit_log: str = commits, year: int = None
) -> (str, str):
"""
Calculate the amount of inserts / deletes per month from the
@JnyJny
JnyJny / eriks_178_solution.py
Created March 12, 2020 16:42
How I would implement 178
#!/usr/bin/env python3
""" short module description
Longer module description goes here.
"""
from collections import defaultdict
from dateutil.parser import parse
@JnyJny
JnyJny / Makefile
Last active March 18, 2020 13:42
Generate HTML, PDF, EPUB and MOBI from ASCIIDoctor Source
# Makefile - Generate HTML, PDF, EPUB, MOBI from ASC
# This is how you assign a string to a variable name in 'make'. The
# variable name doesn't have to be all caps and the equal doesn't have
# to be snugged up to the variable name; it's just how I write
# Makefiles
FILENAME= the_document
# $(IDENTIFIER) is how you reference a 'make' variable, you can use
import hid
d = hid.device()
d.open(0x2c0d, 1)