Skip to content

Instantly share code, notes, and snippets.

View RickyCook's full-sized avatar
🏳️‍🌈

Ricky Cook RickyCook

🏳️‍🌈
View GitHub Profile
defmodule Notifier.Webhook.App do
use Application
require Logger
def start(_type, _args) do
Logger.debug("App.start")
import Supervisor.Spec
children = [
supervisor(Notifier.Webhook.Worker, []),
@RickyCook
RickyCook / main.js
Last active December 7, 2018 02:51
A TamperMonkey script that hides the Reddit post list "underlay" when you open a post thread
// ==UserScript==
// @name RedditHider
// @namespace https://www.reddit.com
// @version 0.2
// @description Hide Reddit main page when a thread is opened
// @author Ricky Cook
// @include https://www.reddit.com/*
// @grant none
// @updateURL https://gist.githubusercontent.com/RickyCook/72fc3a971a638b10864d98ffe3fc2ffd/raw/main.js
// ==/UserScript==
@RickyCook
RickyCook / promiseState.js
Last active June 1, 2021 19:10
JS func to get the state of a promise
/* Checks the state of a Promise without need to wait for a non-pending result
*
* This is an issue, because the state of a Promise object is inaccessible from
* JavaScript, so we are unable to take actions based on the current state of
* a Promise being pending or not
*/
const PROMISE_STATE_PENDING = Symbol()
async function promiseState(prom) {
try {
const result = await Promise.race([prom, Promise.resolve(PROMISE_STATE_PENDING)])
@RickyCook
RickyCook / hexdump.py
Last active August 29, 2018 01:17
Approximate recreation of the ``hexdump`` CLI utility in Python
#!/usr/bin/env python
""" Approximate recreation of the ``hexdump`` CLI utility.
Several versions of the function are included:
hexdump_lines: Dumps out an iterator of lines. I/O is streamed by generators
hexdump_string: Splits, and dumps out a string
hexdump_stream: Splits, and dumps out a stream. I/O is streamed
Examples:
@RickyCook
RickyCook / dev_setup.sh
Last active February 8, 2018 02:55
Clone truffle repos, and interlink them with all their node_modules for a full local dev environment
#!/bin/bash
set -e
this_dir="$(cd "$(dirname "$0")"; pwd)"
script_name="$0"
repo_prefix='https://github.com/trufflesuite/'
repo_suffix='.git'
@RickyCook
RickyCook / ts-commands.md
Last active October 2, 2017 01:04
timesheet bot

Things to say:

  • Start project full project name
  • Start project fpn
  • Start new entry
  • New entry
  • Start on some entry description
  • Start on some project name
  • Start some entry description
  • Start some project name
  • End entry
var smartFormsStaticPrefix = '/_smart_forms/static',
smartFormsApiPrefix = '/_smart_forms/api'
function smartFormsInit() {
var req = new XMLHttpRequest()
function transformElementUrls(el) {
var href = el.getAttribute('href'),
src = el.getAttribute('src')
if (href !== null) el.setAttribute('href', smartFormsStaticPrefix + '/' + href)
alert('loaded from github')
install
text
skipx
unsupported_hardware
lang en_AU.UTF-8
timezone Australia/Melbourne
keyboard us
network --bootproto=dhcp
GROUP_BITS = 31
PRIME = 7
def ddd(index):
"""
Examples:
>>> ddd(111)
'00*00*0001***0*0*001****0**0**'
"""