Skip to content

Instantly share code, notes, and snippets.

View lf-'s full-sized avatar
💭
GitHub 💧🧊

Jade Lovelace lf-

💭
GitHub 💧🧊
View GitHub Profile
~ » cd dev
~/dev » cd mercury-web-jacked
direnv: loading ~/dev/mercury-web-jacked/.envrc
direnv: using nix
direnv: export +AR +AS +CC +CHROMATIC_PROJECT_TOKEN +CONFIG_SHELL +CUSTOM_META_TAG_IN_DEV +CXX +DETERMINISTIC_BUILD +HOST_PATH +IN_NIX_SHELL +LD +NIX_BINTOOLS +NIX_BINTOOLS_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu +NIX_BUILD_CORES +NIX_BUILD_TOP +NIX_CC +NIX_CC_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu +NIX_CFLAGS_COMPILE +NIX_ENFORCE_NO_NATIVE +NIX_HARDENING_ENABLE +NIX_INDENT_MAKE +NIX_LDFLAGS +NIX_STORE +NM +NODE_BUILD_MEMORY_LIMIT +NODE_ENV +NODE_PATH +OBJCOPY +OBJDUMP +PYTHONHASHSEED +PYTHONNOUSERSITE +PYTHONPATH +RANLIB +REACT_APP_BACKEND_SOURCE +REACT_APP_BUGSNAG_API_KEY +REACT_APP_BUGSNAG_RELEASE_STAGE +REACT_APP_MERCURY_DOMAIN +REACT_APP_NO_BUGSNAG_REPORT +REACT_APP_PERSONA_ENVIRONMENT +REACT_APP_SEGMENT_KEY +REACT_APP_TEST_BANK_REWRITE +REACT_APP_XERO_OAUTH_2_CLIENT_ID +READELF +SIZE +SOURCE_DATE_EPOCH +STRINGS +STRIP +TEMP +TEMPDIR +TMP +WEBPACK_DEV_SERVER_SSL +_PYTHON_HOST_PLATFORM +_P
@lf-
lf- / writeonly.md
Last active September 6, 2020 09:56
writeonly writeup
import logging
from pathlib import Path
import time
import requests
MAILGUN_API_KEY = 'key-xxxxx'
MAILGUN_DOMAIN = 'yourdomain.ca'
MAILGUN_FROM = 'dellwatch <dellwatch@yourdomain.ca>'
MAILGUN_TO = 'you@yourdomain.ca'
@lf-
lf- / catanrandom.py
Created July 15, 2017 18:24
A little randomizer script for Settlers of Catan
from __future__ import print_function
import random
board = ['wheat', 'wood', 'sheep'] * 4 + ['rock', 'brick'] * 3 + ['desert']
random.shuffle(board)
slices = [
board[0:3],
board[3:7],
board[7:12],
"""
Add copy to clipboard from IPython!
To install, just copy it to your profile/startup directory, typically:
~/.ipython/profile_default/startup/
Example usage:
%clip hello world
# will store "hello world"
a = [1, 2, 3]
%clip a
# will store "[1, 2, 3]"
@lf-
lf- / with_lennyface.py
Created June 28, 2017 20:10
I blame @parrottq for this
import contextlib
@contextlib.contextmanager
def lennyface():
global print
oldprint = print
def new_print(*args, **kwargs):
#newargs = [a.replace(' ', '( ͡° ͜ʖ ͡°)') for a in args]
args = list(args)
@lf-
lf- / screw_dbus.py
Created June 24, 2017 05:30
A hack to get async dbus working (ironically it works with dbus-python, but not pydbus)
# <hack>
# our D-Bus library is missing async :(
# source: https://github.com/LEW21/pydbus/issues/58
def _async_result_handler(obj, result, user_data):
"""Generic callback dispatcher called from glib loop when an async method
call has returned. This callback is set up by method dbus_async_call."""
(result_callback, error_callback, real_user_data) = user_data
try:
ret = obj.call_finish(result)
127.0.0.1: =====================================================
127.0.0.1: IPMI 1.5 Get Channel Authentication Capabilities Request
127.0.0.1: =====================================================
127.0.0.1: RMCP Header:
127.0.0.1: ------------
127.0.0.1: [ 6h] = version[ 8b]
127.0.0.1: [ 0h] = reserved[ 8b]
127.0.0.1: [ FFh] = sequence_number[ 8b]
127.0.0.1: [ 7h] = message_class.class[ 5b]
127.0.0.1: [ 0h] = message_class.reserved[ 2b]
@lf-
lf- / fuposix.c
Created April 20, 2017 06:43
Because POSIX behaviour is obnoxious sometimes. A super thin syscall wrapper so posix will never bother us again.
#include <stdio.h>
#include <unistd.h>
#include <string.h>
typedef int (*scfunc)(const char *, const char *);
struct SysCall {
char* name;
scfunc func;
import json
import os
import os.path
import platform
import requests
import shutil
import subprocess
import time