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 | |
# aapl_slurp.rb: downloader for Apple open source projects | |
# Copyright © 2017, Ramsey Dow. All rights reserved. | |
# SPDX-License-Identifier: BSD-2-Clause | |
# mkdir /tmp/macOS-1013 && pushd !#:1 | |
# curl -#LO https://opensource.apple.com/plist/macos-1013.plist | |
# SSL_CERT_FILE=$CURL_CA_BUNDLE ruby /path/to/aapl_slurp.rb macos-1013.plist |
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 | |
# dga.rb: domain generation algorithm inspired by Ranbyus (by way of Mirai) | |
# Usage: ruby dga.rb [n] | |
# where n is an integer representing the number of days to span. | |
# -n indicates previous days, 0 and 1 indicate today, and 2+ indicates tomorrow and so on. | |
module DNS | |
LETTERS='abcdefghijklmnopqrstuvwxyz'.scan(/./) |
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
(function() { | |
'use strict'; | |
function runWithDebugger(f, args) { | |
if (typeof f !== 'function') { throw 'f must be a function' } | |
// The apply() method treats unspecified args or null or undefined args as 'no args'. | |
if (args === undefined || typeof args === 'object' && (args === null || Array.isArray(args))) { | |
debugger; | |
f.apply(null, args); | |
} else { |
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
const fs = require('fs'); | |
const ua = fs.readFileSync('ua.txt').toString().split("\n"), | |
agent = ua[Math.floor(Math.random()*ua.length)]; | |
console.log(agent); |
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
// cvss.js: Compute CVSSv3 score from vector. | |
// Copyright © 2018, Ramsey Dow. All rights reserved. | |
// SPDX-License-Identifier: BSD-2-Clause | |
// Developed under the influence of Rick and Morty. TINY RICK! | |
const vectorToObject = (string) => { | |
const metrics = {}; | |
if (isEmpty(string)) throw 'Empty string'; | |
const scratch = string.split('/'); |
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 | |
case $((RANDOM % 4)) in | |
1) precip=🔪 ;; | |
*) precip=❄️ ;; | |
esac | |
lines=$(tput lines) | |
columns=$(tput cols) |
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 Foundation | |
import PlaygroundSupport | |
func constructPathname(pathname: URL, name: String, ext: String) -> URL { | |
let n = name.hasSuffix(".") ? String(name.dropLast()) : name | |
let x = ext.hasPrefix(".") ? String(ext.dropFirst()) : ext | |
return pathname.appendingPathComponent("\(n).\(x)") | |
} | |
print(constructPathname(pathname: playgroundSharedDataDirectory, name: "Tea, Inc.", ext: ".json")) |
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 | |
((EUID != 0)) && printf >&2 "This script should be run as root\\n" && exit 1 |
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 | |
# atv_vidslurp.rb, 20161216 yesmar@gmail.com | |
# Pull down Apple's HD screensaver vids from Phobos. | |
require 'net/http' | |
require 'json' | |
PHOBOS_URL='http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/entries.json' |
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 | |
mkdir -p /tmp/freebsd && pushd !#:2 | |
curl -#LO https://www.freebsd.org/releases/11.1R/CHECKSUM.SHA512-FreeBSD-11.1-RELEASE-amd64.asc | |
curl -#LO https://download.freebsd.org/ftp/releases/amd64/amd64/ISO-IMAGES/11.1/FreeBSD-11.1-RELEASE-amd64-memstick.img.xz | |
mkdir -p keyring && chmod 0700 !#:2 | |
gpg --homedir=keyring --keyserver keyserver.ubuntu.com --recv-keys 8D12403C2E6CAB086CF64DA3031458A5478FE293 | |
gpg --homedir=keyring --verify CHECKSUM.SHA512-FreeBSD-11.1-RELEASE-amd64.asc | |
grep FreeBSD-11.1-RELEASE-amd64-memstick.img.xz \ | |
CHECKSUM.SHA512-FreeBSD-11.1-RELEASE-amd64.asc \ | |
| awk '{ gsub("[()]",""); print $4 " " $2 }' \ |