Skip to content

Instantly share code, notes, and snippets.

View yyolk's full-sized avatar
🍯
𝙧𝙚𝙘𝙪𝙧𝙨𝙞𝙫𝙚 𝙩𝙖𝙪𝙩𝙤𝙡𝙤𝙜𝙮

Joseph Chiocchi yyolk

🍯
𝙧𝙚𝙘𝙪𝙧𝙨𝙞𝙫𝙚 𝙩𝙖𝙪𝙩𝙤𝙡𝙤𝙜𝙮
View GitHub Profile
@yyolk
yyolk / _rtorrent-pushover.md
Last active October 31, 2022 00:23
rtorrent + pushover howto & sample

#script to use pushover for rtorrent notifications

Used for openelec [unofficial][unofficial] rtorrent addon but can be part of any rtorrent setup.

  1. Buy Pushover for [iOS][ios] or [Android][android]
  2. Create a new app, and upload a custom icon for your notifications.
  3. [Download][rbraw] or copy rtorrent-notification.rb into a new file
  4. Insert your new app's API token in script under token
#!/bin/sh
awk 'function wl() {
rate=64000;
return (rate/160)*(0.87055^(int(rand()*10)))};
BEGIN {
srand();
wla=wl();
while(1) {
wlb=wla;
wla=wl();
@yyolk
yyolk / sample_sns_event.json
Created October 30, 2015 20:52
AWS Lambda SNS Sample Event
{
"Records": [
{
"EventVersion": "1.0",
"EventSubscriptionArn": "arn:aws:sns:EXAMPLE",
"EventSource": "aws:sns",
"Sns": {
"SignatureVersion": "1",
"Timestamp": "1970-01-01T00:00:00.000Z",
"Signature": "EXAMPLE",
@yyolk
yyolk / GH-CF-strict-SSL-w-CDN.md
Created August 27, 2021 19:48 — forked from zbeekman/GH-CF-strict-SSL-w-CDN.md
Setting up GH-pages with custom domain, strict (end-to-end) SSL with CloudFlare DNS & CDN

Custom domains, GH-pages, Cloudflare and strict SSL end-to-end encryption

Why I wrote this

Before Github supported SSL encryption for github pages sites, many people were using CloudFlare (CF) as their DNS provider and CDN proxy. CF allowed users to enable SSL encryption from the CDN end points/proxies to the end user. This was great and it allowed visitors to your website to connect with a secure connection between their browser and the cloudflare CDN box that was serving your content. However, with this setup one (significant) link in the chain remained unencrypted and

@yyolk
yyolk / simple_xrp_price_agg.py
Created August 3, 2021 18:38
simple price aggregate with ccxt
import ccxt
def get_price(exchange_client, pair) -> float:
return exchange_client.fetch_ticker(pair).get("last")
if __name__ == "__main__":
binance = (ccxt.binance(), "XRP/USDT")
bitfinex = (ccxt.bitfinex(), "XRP/USD")
@yyolk
yyolk / 01__websockets__xrpl_stat_table.py
Last active July 9, 2021 03:56
using python3, websockets and asyncio connect to rippled, subscribe and work on received messages
#!/usr/bin/env python3
"""
Prints out the Ledger No. and the total txns, along with a visual indication.
Illustrates a raw web socket connection and consuming the messages with asyncio
Setup:
If you're running an XRPL node, run this script on the node with the admin
@yyolk
yyolk / websocat_subscribe_jq_process.sh
Last active July 7, 2021 19:29
watch subscribed events to your xrpl node from the command line
#!/bin/bash
# install websocat
# cargo install --features=ssl websocat
# --features=ssl needs to be included to connect to wss://
# we use `<<<` to send a string into the command:
# echo '{"command"...}' | websocatt ...
# is equivalent
@yyolk
yyolk / snp
Created April 28, 2021 00:33 — forked from erikw/snp
snp: Wrap shell command in BTRFS snapper pre-post snapshots and log outputs.
#!/usr/bin/env bash
# Runs a command wrapped in btrfs snapper pre-post snapshots.
# Usage: $ snp <commands>
# e.g.: $ snp pacman -Syyu
# The latest version of this script is hosted at https://gist.github.com/erikw/5229436
log_path="/var/local/log/snp"
date=$(date "+%Y-%m-%d-%H%M%S")
log_file="${log_path}/snp_${date}.log"
@yyolk
yyolk / Exclude_tables.md
Last active August 18, 2020 16:56 — forked from utek/Exclude_tables.md
Define ignored tables in alembic.ini

Add this in your ini file:

[alembic:exclude]
tables = spatial_ref_sys

In env.py:

@yyolk
yyolk / goog.sh
Created February 9, 2020 22:42
a bash cli for googling things from the cli using, can be easily ported elsewhere source and then `goog something i'm looking for`
# modified from https://stackoverflow.com/a/10660730
rawurlencode() {
local string="${1}"
local strlen=${#string}
local encoded=""
local pos c o
for (( pos=0 ; pos<strlen ; pos++ )); do
c=${string:$pos:1}
case "$c" in