Skip to content

Instantly share code, notes, and snippets.

View LevitatingBusinessMan's full-sized avatar
🕴️
Ricing my polybar...

Rein Fernhout LevitatingBusinessMan

🕴️
Ricing my polybar...
View GitHub Profile
#!/usr/bin/env ruby
require "dbus"
system_bus = DBus::SystemBus.instance
session_bus = DBus::SessionBus.instance
$networkd_service = system_bus.service("org.freedesktop.network1")
$networkd_object = $networkd_service.object("/org/freedesktop/network1")
$networkd_properties = $networkd_object["org.freedesktop.DBus.Properties"]
$networkd_manager = $networkd_object["org.freedesktop.network1.Manager"]
require 'nokogiri'
require 'open-uri'
require 'rss'
URL = URI("https://community.elitedangerous.com/")
doc = Nokogiri::HTML(URL.open)
articles = doc.css("div.article").map {|article| [
article.css("h3.galnetNewsArticleTitle a").first.content.strip, #title
article.css("h3.galnetNewsArticleTitle a").first.attr("href").strip, #link
#include <asm-generic/socket.h>
#include <stdio.h>
#include <sys/socket.h>
#include <unistd.h>
#include <netinet/in.h>
#include <sys/time.h>
#include <netinet/tcp.h>
#define NONAGLE 1
@LevitatingBusinessMan
LevitatingBusinessMan / authenticate.rb
Created May 7, 2024 23:58
Proving that spotify isn't random
RSpotify.authenticate CLIENT_ID, CLIENT_SECRET
REDIRECT_URI = "http://localhost:3000"
SCOPE = [
"user-read-playback-state",
"streaming"
]
begin
@LevitatingBusinessMan
LevitatingBusinessMan / wrap.fish
Created April 9, 2024 01:48
like rlwrap but in 10 lines of fish
#!/usr/bin/env fish
while true
read -P "" input
if test $status -ne 0
break
end
echo $input
end | $argv
@LevitatingBusinessMan
LevitatingBusinessMan / recipient_email.js
Last active March 23, 2024 01:39
Userscript to ensure that a recipients email address is shown when composing in roundcube
// ==UserScript==
// @name RecipientEmailFixerRoundcube
// @version 1
// @grant none
// ==/UserScript==
function on_mutation() {
document.querySelectorAll("body.action-compose li.recipient").forEach(recipient => {
if (!recipient.fixed) {
const [name, email] = recipient.children
#!/usr/bin/env fish
set packages (paclist core | cut -f1 -d' ')
set --erase IFS
set parallel 10
set mirror 'http:\/\/ftp.snt.utwente.nl\/pub\/os\/linux\/archlinux\/$repo\/os\/$arch'
# setup the config
set config (cat pacman.conf | sed \
-e "s/Include = \/etc\/pacman.d\/mirrorlist/Server = $mirror/" \
-e "s/\#ParallelDownloads = 5/ParallelDownloads = $parallel/"
@LevitatingBusinessMan
LevitatingBusinessMan / coroutine.c
Last active February 28, 2024 08:49
A totally sane implementation of a coroutine in C
#include <stdio.h>
#define COROUTINE static long ip = 0; if (ip) asm ("jmp *%0" : : "r" (ip + 7));
#define YIELD_32(i) asm volatile("movl %1, %%eax \n pop %%rbp \n call 1f\n 1: pop %0 \n ret" : "=m" (ip) : "r" (i));
int fibonacci() {
COROUTINE
YIELD_32(0);
YIELD_32(1);
YIELD_32(1);
@LevitatingBusinessMan
LevitatingBusinessMan / wallpapercycle.sh
Created October 23, 2023 21:12
Cycle through wallpapers
#!/bin/sh
file=`ls -dt ~/wallpapercycle/* | tail -n1`
touch $file
echo $file
feh --bg-tile $file
@LevitatingBusinessMan
LevitatingBusinessMan / subdomains.fish
Last active October 6, 2023 11:52
Bruteforce subdomains
#!/usr/bin/env fish
argparse n/nameserver= d/domain= w/wordlist= o/output= -- $argv
or exit
if test -z $_flag_n; or test -z $_flag_d; or test -z $_flag_w
echo "Required arguments: nameserver, domain, wordlist"
echo "You can find the nameserver with nslookup and querytype=soa"
exit
end