Skip to content

Instantly share code, notes, and snippets.

@Donearm
Donearm / mpd-ttytter_now_playing.sh
Last active September 2, 2021 09:27
Script to capture info on currently playing song in MPD, add an (optional) prefix and/or suffix and tweet it all via TTYtter
#!/bin/sh
# Script to capture info on currently playing song in MPD, add an
# (optional) prefix and/or suffix and tweet it all via TTYtter (which
# must be of course already been configured)
#
# Dependencies: TTYtter, a MPD client that can output song info (I use
# ncmpcpp)
PREFIX='on air: ' # what should go before the now playing string

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@Swizec
Swizec / HNApi.js
Created August 3, 2017 15:49
Unofficial HackerNews write API wrapper
import cheerio from 'cheerio-without-node-native';
const convertRequestBodyToFormUrlEncoded = (data) => {
const bodyKeys = Object.keys(data);
const str = [];
for (let i = 0; i < bodyKeys.length; i += 1) {
const thisKey = bodyKeys[i];
const thisValue = data[thisKey];
str.push(`${encodeURIComponent(thisKey)}=${encodeURIComponent(thisValue)}`);
@EdJoPaTo
EdJoPaTo / aurstuff.md
Last active May 11, 2023 04:08
useful commands while building an AUR package

Start a new one

git clone ssh://aur@aur.archlinux.org/package_name.git

Prototype files are in /usr/share/pacman

Tools

Generate md5sums

@Vexs
Vexs / emoji_map.json
Last active January 31, 2024 10:46
Discord emoji mapping. This is a JSON file! Please load it with json. Attempting to copy-paste it directly into python will not work! For diversity, see: https://gist.github.com/Vexs/9e4c14d41161590ca94d0d21e456fef0
{
"grinning": "\ud83d\ude00",
"smiley": "\ud83d\ude03",
"smile": "\ud83d\ude04",
"grin": "\ud83d\ude01",
"laughing": "\ud83d\ude06",
"satisfied": "\ud83d\ude06",
"face_holding_back_tears": "\ud83e\udd79",
"sweat_smile": "\ud83d\ude05",
"joy": "\ud83d\ude02",
@sim642
sim642 / reddit-sendbird.ts
Last active March 11, 2023 21:36
Reddit Chat (via SendBird) reverse engineering
import * as request from "request";
import * as SendBird from "sendbird";
const sendbirdServiceUrl = "https://sendbird.reddit.com";
const sendbirdAppId = "2515BDA8-9D3A-47CF-9325-330BC37ADA13";
const userId = "t2_mv8j9bt"; // chatrev1
const accessToken = "49777998329-oof4CSA1jedsnu6pXgJj_SFIk7o";
// accessToken (bearer):
// full (personalized) oauth2 access token (from web/installed reddit app): user id base 10 - oauth2 access token
@Lartza
Lartza / tmux.conf
Last active May 9, 2024 23:42 — forked from anonymous/tmux.conf
vim friendly tmux configuration
#Prefix is Ctrl-a
set -g prefix C-a
bind C-a send-prefix
unbind C-b
set -sg escape-time 1
set -g base-index 1
setw -g pane-base-index 1
#Mouse works as expected
@greenstick
greenstick / print-progress-auto.py
Last active June 27, 2024 20:04
Python: printProgressBar function with autoresize option
# This version of the printProgressBar function implements an optional autoresize argument.
# It has been updated from a previous version to use the shutil Python module to determine
# the terminal size. This update should allow it to work on most operating systems and does
# speed up the autosize feature quite a bit – though it still slows things down quite a bit.
# For more robust features, it's recommended you use a progress bar library like tdqm (see: https://github.com/tqdm/tqdm)
def printProgressBar (iteration, total, prefix = '', suffix = '', decimals = 1, length = 100, fill = '█', autosize = False):
"""
Call in a loop to create terminal progress bar
@params:
@tuxarch
tuxarch / orphans.hook
Created November 9, 2019 13:22 — forked from Strykar/orphans.hook
Pacman post transaction hook to list/remove orphaned packages
[Trigger]
Operation = Install
Operation = Upgrade
Operation = Remove
Type = Package
Target = *
[Action]
Description = Searching for orphaned packages...
When = PostTransaction
@tjluoma
tjluoma / youtube-rss.sh
Last active January 3, 2023 09:00
Did you know YouTube has RSS feeds? No? Probably because YouTube makes them nearly impossible to find. But here's an easy way to get the RSS feed for any YouTube user. Inspired by <https://eggfreckles.net/notes/youtube-rss/>
#!/usr/bin/env zsh -f
# Purpose: get the RSS feed for a YouTube page
# Inspired By: https://eggfreckles.net/notes/youtube-rss/
# Gist: https://gist.github.com/tjluoma/fdbc63ceb78a2aecd3d638fd18b6ec6e
#
# From: Timothy J. Luoma
# Mail: luomat at gmail dot com
# Date: 2020-01-17; updated 2021-01-10
# 2021-01-10 YouTube currently has both 'rssUrl' and