Skip to content

Instantly share code, notes, and snippets.

@luelista
luelista / git-jetbrains-nav.user.js
Created February 5, 2024 09:49
github/gitlab jetbrains nav (click on the "Raw" button to install)
// ==UserScript==
// @name github/gitlab jetbrains nav
// @author Mira
// @version 1
// @grant GM.xmlHttpRequest
// @match https://github.com/*
// @match https://gitlab.com/*
// ==/UserScript==
/***********************************************************************
@luelista
luelista / collect_notifications.sh
Last active November 6, 2023 01:15
Scripts to fetch mastodon notification data and put in local SQLite, for further analysis
# run repeatedly until you have collected enough notifications
curl -H "authorization: Bearer $MASTODON_TOKEN" "https://$MASTODON_HOST/api/v1/notifications?limit=30&max_id=$(sqlite3 mastodon.db 'select min(nid) from noti;' || echo 0)" \
| jq '.[] | {nid:.id,type,created_at,user:.account.username,sid:.status.id,content:.status.content}' \
| dumptodb --db mastodon.db --table noti --key nid
@luelista
luelista / monty.py
Created February 26, 2023 15:16
Monty Hall Problem
#!/usr/bin/env python3
import random
import sys
class GameMasterStrategy:
def step1(self):
self.doors = [1,2,3]
self._correctDoor = random.choice(self.doors)
return self.doors
@luelista
luelista / simpletest.py
Last active May 2, 2022 20:00
Test for Qt-Ads bug
import sys
from PyQt5.QtWidgets import QApplication, QMainWindow, QTextEdit, QLabel
from PyQt5.QtCore import Qt
from PyQtAds import ads
def makewindow(name):
txt = QTextEdit()
@luelista
luelista / dino.rb
Last active August 30, 2020 18:26
Homebrew formula for dino.im XMPP client
class Dino < Formula
desc "Modern Jabber/XMPP Client using GTK+/Vala "
homepage "https://dino.im"
## TODO: This is not really a version, but a dummy that's not going to work.
# url "https://github.com/dino/dino/archive/0.0.tar.gz"
# sha256 "a951b50559671ab30e74304ddc66c943405c8ad1bcbe4d77bef647a081fd0dbb"
head do
url "https://github.com/dino/dino.git"
@luelista
luelista / show_downloadable.sh
Last active July 24, 2020 12:15
List and update the download URL of all downloadable files of virtual products in a WooCommerce installation
(wp post list --post_type=product_variation --meta_key=_downloadable_files --fields=ID | tail -n +2;
wp post list --post_type=product --meta_key=_downloadable_files --fields=ID | tail -n +2) | (
while read ID; do wp post meta get $ID _downloadable_files ; done)
// library: Infrared
// Sends Rc5 0/1 twice with different toggle values.
// Turns e.g. a Philips TV to channel 11.
#include <Rc5Renderer.h>
#include <IrSenderNonMod.h>
static IrSenderNonMod sender(3);
IrSignal *signal ;
THE LOW-DOWN ON LOADALL:
EXCERPTS FROM THE BOOK
THE HYPER-SPACE NAVIGATOR'S GUIDE
by
Terrance E. Hodgins
copyright (C) 1990 by Terrance E. Hodgins,
All rights reserved.
@luelista
luelista / dell_P4317Q_ctrl.py
Last active April 26, 2019 12:51
Control Dell P4317Q monitor over RS232
#!/usr/bin/env python3
# Control Dell P4317Q monitor over RS232
# usage examples:
# read monitor name string and brightness: ./dell_P4317Q_ctrl.py eb01 eb30
# set brightness to minimum: ./dell_P4317Q_ctrl.py ea3000
# set brightness to maximum: ./dell_P4317Q_ctrl.py ea30ff
# night mode: ./dell_P4317Q_ctrl.py eb01 ea3000 ea3133 ea4800010000
@luelista
luelista / HexTweets.user.js
Created December 29, 2018 17:41
Colors tweets with hex color hashtags
// ==UserScript==
// @name HexTweets
// @version 1
// @grant none
// @match https://twitter.com/*
// ==/UserScript==
var re = /^#[a-fA-F0-9]{6}$/;
var hashtags = document.querySelectorAll("div.tweet a.twitter-hashtag");
for(var i in hashtags) {