This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'bundler' | |
Bundler.require | |
require 'sinatra' | |
set :bind, '0.0.0.0' | |
set :port, 80 | |
def show_credentials(request) | |
<<-EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Copyright (c) 2021 Dan Q; released under the MIT License. */ | |
const Puppeteer = require('puppeteer'); | |
getAvatar = async (twitterUsername) => { | |
const browser = await Puppeteer.launch({args: ['--no-sandbox', '--disable-setuid-sandbox']}); | |
const page = await browser.newPage(); | |
await page.goto(`https://twitter.com/${twitterUsername}`); | |
await page.waitForSelector('a[href$="/photo"] img[src]'); | |
const url = await page.evaluate(()=>document.querySelector('a[href$="/photo"] img').src); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 REM WEREWOLVES AND WANDERER | |
20 GOSUB 2600:REM INTIALISE | |
30 GOSUB 160 | |
40 IF RO<>11 THEN 30 | |
50 PEN 1:SOUND 5,100:PRINT:PRINT "YOU'VE DONE IT!!!":GOSUB 3520:SOUND 5,80:PRINT "THAT WAS THE EXIT FROM THE CASTLE!":SOUND 5,200 | |
60 GOSUB 3520 | |
70 PRINT:PRINT "YOU HAVE SUCCEEDED, ";N$;"!":SOUND 5,100 | |
80 PRINT:PRINT "YOU MANAGED TO GET OUT OF THE CASTLE" | |
90 GOSUB 3520 | |
100 PRINT:PRINT "WELL DONE!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# The following steps, which were tested on Ubuntu 18.04 LTS and on the Ubuntu-powered Linux for Windows Subsystem on Windows, | |
# will: | |
# | |
# * Compile a recent version of OpenSSL (you can skip this step and use your package maintainer's version if you prefer, but you | |
# might have to tweak a few bits) | |
# * Create a separate set of configuration files suitable for configuring a basic CA capable of signing EV certificates | |
# * Create such a CA (hackerca.local / HackerCA EV Root CA) | |
# * Create a certificate request for a site, hackersite.local, belonging to company "Barclays PLC [GB]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name radio.garden: bypass region restrictions (e.g. UK) | |
// @namespace dqne.me.radio.garden | |
// @match http://radio.garden/* | |
// @grant none | |
// @version 1.0 | |
// @author Dan Q <https://danq.me/> | |
// @description Adds a secondary player interface to radio.garden which still works even on region-blocked radio stations. Allows listening to non-UK stations from the UK. | |
// @run-at document-idle | |
// ==/UserScript== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env ruby | |
# Run with e.g.: | |
# ruby strikecalendar-to-ical.rb > output.ics | |
# PLEASE READ AND UNDERSTAND SOURCE CODE FIRST: THERE'S A MAJOR SECURITY RISK ON LINE 25 | |
# Dependencies | |
require 'bundler/inline' | |
gemfile do | |
source 'https://rubygems.org' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/php | |
<?php | |
define('Q23_WP_DIR', '/www/danq.me/www'); | |
define('Q23_MASTODON_SERVER', 'm.danq.me'); | |
define('Q23_MASTODON_META_KEY', 'q23_mastodon_sync'); | |
define('Q23_MASTODON_META_SYNDICATION_LINKS', 'mf2_syndication'); | |
define('Q23_MASTODON_SYNC_POSTS_LIMIT', 30); | |
define('Q23_MASTODON_SYNC_REPLIES_LIMIT', 30); | |
define('Q23_MASTODON_COMMENT_USER_AGENT', 'Q23 DanQ.me Mastodon Comment Backfeeder'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# This program gets executed (by /etc/efingerd/luser) when somebody runs finger something@danq.me | |
# The output is returned directly to them | |
# For more information, see https://danq.me/wp-finger | |
require 'mysql2' | |
require 'word_wrap' | |
require 'word_wrap/core_ext' | |
db = Mysql2::Client.new(username: 'WORDPRESS_DB_USERNAME', password: 'WORDPRESS_DB_PASSWORD', database: 'WORDPRESS_DB_NAME') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Dependencies | |
require 'bundler/inline' | |
gemfile(true) do | |
source 'https://rubygems.org' | |
gem 'win32-sound', require: 'win32/sound' | |
end | |
include Win32 | |
FREQUENCY = 37 # Hz; 37-32767 - what pitch sound? | |
DURATION = 1 # Ms - how long to play for? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This version works with modern browsers | |
function lazyLoadCSS(){ | |
[...document.querySelectorAll('noscript[lazyload]')].forEach(ns=>ns.outerHTML=ns.innerHTML); | |
} | |
(document.readyState != 'loading') ? lazyLoadCSS() : document.addEventListener('DOMContentLoaded', lazyLoadCSS); |