This file contains hidden or 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 fish | |
if test -f ".req.conf" | |
rm .req.conf | |
end | |
set STRBASE "[req] | |
distinguished_name = dn | |
x509_extensions = v3_req | |
prompt = no |
This file contains hidden or 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 Get-RandomSuccess { | |
$val = Get-Random -Maximum 2 | |
$val -eq 0 | |
} | |
function Get-RandomThrow { | |
if (!(Get-RandomSuccess)) { | |
throw "ERR" | |
} |
This file contains hidden or 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
class SwisConnection { | |
[String] $HostName | |
[Bool] $UseSSL | |
[Bool] $ValidateSSL | |
[Int] $Port | |
[PSCredential] $Credential | |
SwisConnection( | |
[String] $HostName, | |
[Bool] $UseSSL, |
This file contains hidden or 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 { Worker, isMainThread, parentPort, workerData } = require('node:worker_threads'); | |
const randIdx = vals => Math.floor(Math.random() * vals.length); | |
const permute4 = vals => { | |
const vCopy = [...vals]; | |
if (vCopy.length !== 4) | |
throw new Error('Array must be of size 4'); |
This file contains hidden or 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 fetch = require("node-fetch"); | |
const { readFileSync, writeFileSync } = require('fs'); | |
const getAccess = async () => { | |
const refresh_token = readFileSync('last_refresh', { encoding: 'utf-8' }); | |
const data = new URLSearchParams(); | |
data.append('refresh_token', refresh_token); | |
data.append('grant_type', 'refresh_token'); |
This file contains hidden or 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
$TTL 60 | |
$ORIGIN local.example.com. | |
@ IN SOA examplecom.ddns.net. admin.example.com. {{SERIAL}} 300 900 604800 60 | |
@ IN NS examplecom.ddns.net. | |
@ IN A {{EXT_IP}} | |
* IN CNAME examplecom.ddns.net. |
This file contains hidden or 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 generateHeadings = () => { | |
let date = new Date('2023-08-31T00:00:00'); | |
date.setHours(0); | |
date.setMinutes(0); | |
date.setSeconds(0); | |
date.setMilliseconds(0); | |
for (; date.getTime() >= Date.parse('2023-06-01T00:00:00'); date.setDate(date.getDate() - 1)) { | |
if (date.getDay() === 0 || date.getDay() === 6) | |
continue; |
This file contains hidden or 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
<?php | |
abstract class DynamicModel { | |
/** @var DBEngine */ | |
protected static $db; | |
protected $id; | |
protected $values; | |
private static $consonants = "bcdfghjklmnpqrstvwxz"; | |
private static $vowels = "aeiou"; |
This file contains hidden or 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
if [ -f ".req.conf" ]; then | |
rm .req.conf | |
fi | |
STRBASE="[req]\ndistinguished_name = dn\nx509_extensions = v3_req\nprompt = no\n\n[dn]\nC = US\nST = Illinois\nL = Chicago\nO = Northwestern University\nOU = Information Technology\nCN = $1\n\n[v3_req]\nkeyUsage = keyEncipherment, nonRepudiation, digitalSignature, dataEncipherment, keyAgreement, keyCertSign\nextendedKeyUsage = serverAuth\nbasicConstraints = CA:true\nsubjectKeyIdentifier = hash\nauthorityKeyIdentifier = keyid:always,issuer:always\nsubjectAltName = @alt_names\n\n[alt_names]" | |
C=1 | |
for var in "$@" | |
do | |
STRBASE="${STRBASE}\nDNS.${C} = ${var}" |
This file contains hidden or 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 countBits = num => { | |
let bits = 0; | |
for (let i = 0; i < 32; ++i) | |
bits += !!(num & (1 << i)) ? 1 : 0; | |
return bits; | |
}; |
NewerOlder