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
import asyncio | |
from bleak import BleakClient, BleakScanner | |
import time | |
from datetime import datetime | |
import sys | |
print("Bluetooth battery monitoring script launched.") | |
args = sys.argv | |
if len(args) < 3: |
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
{- | |
Terminal-based Sokoban in Haskell | |
Author: Franklin P. Dyer | |
Run in the same directory as a text file of Sokoban levels | |
entitled "levels.txt". These should be encoded in the usual way: | |
# - wall | |
- empty (whitespace) | |
$ - crate | |
. - goal | |
* - crate on goal |
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
""" | |
A minimal example of using apscheduler | |
to schedule regularly recurring tasks. | |
""" | |
from datetime import datetime, timedelta | |
from apscheduler.schedulers.blocking import BlockingScheduler | |
# A sample job | |
def my_job(msg): |
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
#include <stdio.h> | |
#include <stdint.h> | |
struct ip4 { | |
uint8_t first; | |
uint8_t second; | |
uint8_t third; | |
uint8_t fourth; | |
}; |
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
# Some useful macros for readable Brainfuck coding. | |
# Usage: ./memorymacros mycode.bf mau-size bus-size | |
cat $1 > $1.tmp1 | |
echo 'Beginning macro expansion. Initial code size:' | |
wc -c $1 | |
# Following pointers | |
perl -pe 's/PTRGO/[NEXTCHUNK PREVCHUNK -RMOVE(CHUNK) NEXTCHUNK]/g' $1.tmp1 > $1.tmp2 |
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
import System.IO | |
import System.Random | |
import System.Timeout | |
import System.Exit | |
import Control.Concurrent | |
import Control.Exception | |
import Data.Char | |
import Data.Maybe | |
import GHC.Float |
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
sudo apt-get update | |
sudo apt-get install ca-certificates curl gnupg lsb-release | |
sudo mkdir -p /etc/apt/keyrings | |
curl -fsSL https://download.docker.com/linux/raspbian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg | |
sudo chmod a+r /etc/apt/keyrings/docker.gpg | |
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/raspbian $(lsb_release -cs) stable" |\ | |
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null | |
sudo apt-get update | |
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin |
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
// Utility for crawling (small) websites and detecting dead links | |
// Enter the URL of the homepage, or the desired starting page of the crawl. | |
// The bot will check validity of links to other domains, but will not recurse over them. | |
// Problematic links are printed to STDOUT. | |
// Progress info (# pending requests) is printed to STDERR. | |
import Queue from 'queue'; | |
import request from 'request'; | |
import follow_redirects from 'follow-redirects'; | |
const https = follow_redirects.https; |
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
<head> | |
<style> | |
div.repl { | |
background-color: black; | |
color: white; | |
font-family: Courier; | |
overflow-y: scroll; | |
height: 200px; | |
padding: 5px; | |
margin: 5px; |
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
// Karabiner complex ruleset for convenient balanced delimiter mapping (macOS). | |
// To install, follow these steps: | |
// 1. Install Karabiner and give it permission to capture from your keyboard in System Preferences. | |
// 2. Go to "complex modifications" and click on "add your own rule". | |
// 3. Paste the below JSON configuration into the text box that opens, and click "save". | |
// Here are all of the mappings that it defines: | |
// - Map Ctrl+9 to (), placing cursor between parens | |
// - Map Ctrl+[ to [], placing cursor between brackets | |
// - Map Ctrl+] to {}, placing cursor between parens | |
// - Map Ctrl+4 to $$, placing cursor between dollar signs (for LaTeX) |
OlderNewer