Skip to content

Instantly share code, notes, and snippets.

View Bestulo's full-sized avatar

Besto Bestulo

View GitHub Profile
@Bestulo
Bestulo / pinboard.css
Last active January 11, 2020 19:39
pinboard.in custom theme
/* Theme Name: Flat Pinboard */
/* Theme URL: http://tackk.com/flat-pinboard */
/* Version: v1.0.1 */
/* Created by: Dan Klammer */
/* Broswer: Chrome + Stylish Extension */
/*
THEME SOURCE: https://gist.github.com/jfred/c5fe00da60a19ff74999223e9a451586
COLORS INVERTED WITH: https://jalu.ch/coding/css-negative.php
@Bestulo
Bestulo / node-polcomp-flair-counter.js
Created June 11, 2020 16:41
Node.js PoliticalCompassMemes flair counting tool
const rp = require('request-promise')
const fs = require('fs')
const baseUrl = 'https://www.reddit.com/r/PoliticalCompassMemes/.json'
const getPCM = (after = '') =>
rp(baseUrl + (after ? '?after=' + after : after)).then(JSON.parse)
const mergeCounters = (arr1, arr2) => {
if (arr1 && arr2) {
// Works for a max of 50 entries
// Needs to inject jQuery first so you can use .map (Reddit uses Jquery Slim which can't map)
// Just copy and paste the contents of minified jQuery into console, then $ = jQuery
// https://code.jquery.com/jquery-3.5.1.min.js
const idarr = []
$(".entry a.title").map((a, b) => idarr.push(/youtu(?:.*\/v\/|.*v\=|\.be\/)([A-Za-z0-9_\-]{11})/.exec($(b).attr('href'))[1]))
console.log('https://www.youtube.com/watch_videos?video_ids=' + idarr.join(','))
@Bestulo
Bestulo / restartcapy.ts
Created October 28, 2022 13:47
restart capy
import { Application } from "https://deno.land/x/[email protected]/mod.ts";
const app = new Application();
app.use((ctx) => {
// if receive request to /restart?bot=capy, use `pm2 restart capy`
if (
ctx.request.url.pathname === "/restart" &&
ctx.request.url.searchParams.get("bot") === "capy"
) {