Skip to content

Instantly share code, notes, and snippets.

View Archenoth's full-sized avatar
💕
Arrested for Oshawott crimes

Arch 💕 Archenoth

💕
Arrested for Oshawott crimes
View GitHub Profile
@Archenoth
Archenoth / NASM Linux 64-bit Assembly example.asm
Last active January 30, 2019 21:44
This will test to see if a file exists and then if it does, exit, or if not, to create it and write some text to it...The Linux Syscall reference used was this: http://web.archive.org/web/20120312200215/http://www.acsu.buffalo.edu/~charngda/linux_syscalls_64bit.html (The first number after each call is the system call number, the next is the add…
;; Write to and create file
global _start
section .text
_start:
;; sys_open(file, permissions)
mov rax, 2 ; sys_open
mov rdi, file ; file
mov rsi, 2 ; Read/Write permissions
syscall
@Archenoth
Archenoth / wordparam.sh
Last active August 29, 2015 14:04
Ever felt an overwhelming urge to use words as command line arguments? Neither have I...but here's a script to find valid commands like "ls -chlorofluorocarbons" or "ls -Spank" anyway! Requires aspell.
#!/bin/bash
([ -z "$1" ] || [ -n "$2" ]) && cat <<EOF && exit 1
wordparam: Find words you can make with the short parameters of commands.
Author: Matthew (Archenoth) MacLean
Usage: "$0 <command>"
EOF
man $1 &>/dev/null || {
@Archenoth
Archenoth / classnamer.pl
Created September 4, 2014 20:38
Classnamer! For those rough times you can't think of a good name for a Java class!
#!/usr/bin/perl
use LWP::Simple;
# Not cheating at all. Nope. Not at all. Nothing to see here...
getprint "http://www.classnamer.com/index.txt";
@Archenoth
Archenoth / PDFDown.pl
Last active August 29, 2015 14:06
A little Perl script to scan a webpage for PDFs and download them all.
#!/usr/bin/perl
#
# Site scraping PDF downloader: By Matthew (Archenoth) MacLean.
#
# This downloader will scan for all PDF links on the URL you pass in
# and download them to their respective files in your current working
# directory.
#
# You will need to install the Crypt::SSLeay CPAN module to download PDFs
# on HTTPS servers.
@Archenoth
Archenoth / watir.org
Last active August 29, 2015 14:24
How to use Watir in Emacs Org mode

Watir Org-mode

This is how you can use Watir inside of org-mode..! First off, you need to have Ruby blocks working.

Second, you need to have both the watir and watir-webdriver

@Archenoth
Archenoth / fortune
Last active August 3, 2022 22:54
/r/nocontext fortune -- Fetches a random /r/nocontext title as the fortune
#!/usr/bin/env ruby
require 'nokogiri'
require 'net/http'
http = Net::HTTP.new("old.reddit.com", 443)
http.use_ssl = true
get = Net::HTTP::Get.new("/r/nocontext/", {
'User-Agent' => 'A fortune script that returns random /r/nocontext titles (Without context of course) (By /u/archenoth)'
})
@Archenoth
Archenoth / bom.el
Last active March 6, 2017 05:47
Opening a UTF file with a BOM marker will make Emacs play "BOM BOM BOOOOM" before letting you see it
(defun detect-bom (filePath)
"Given a filepath, plays BOM BOM BOOOOOM if the file has a BOM"
(with-temp-buffer
(insert-file-contents-literally filePath)
(let ((bom (decode-coding-string (buffer-substring-no-properties 1 4) 'utf-8)))
(when (string= bom (string ?\uFEFF))
(play-sound-file "bombombom.wav")))))
(add-hook 'find-file-hook (lambda () (detect-bom buffer-file-name)))

Keybase proof

I hereby claim:

  • I am archenoth on github.
  • I am archenoth (https://keybase.io/archenoth) on keybase.
  • I have a public key whose fingerprint is 0954 15EB BC51 A046 7587 43EA BB5C A788 18E5 9A5E

To claim this, I am signing this object:

@Archenoth
Archenoth / service
Last active April 19, 2024 01:22
Termux service management script, because convenience, and also because I wanna have fewer runit watchers running all the time
#!/bin/sh
# This script 100% requires termux-services to be installed
if ! dpkg -L termux-services 2>&1 >/dev/null; then
echo "Requires termux-services package to be installed." >&2
read -r -p "Would you like me to install that now? (y/n) " INSTALL >&2
if [ "$INSTALL" != "y" ]; then
echo "Aborting..." >&2
exit 1
@Archenoth
Archenoth / termux.properties
Created February 4, 2020 20:27
Extra keys setup for playing Roguelikes in Termux
extra-keys = [ \
['ESC', '7', 'UP', '9', '\\\''], \
['TAB', 'LEFT', '5', 'RIGHT', '*'], \
['=', '1', 'DOWN', '3', 'ENTER'] \
]