Skip to content

Instantly share code, notes, and snippets.

https://github.com/cisagov/cool-dns-cyber.dhs.gov
go install github.com/terraform-docs/terraform-docs@v0.16.0
terraform-docs markdown --anchor=false --html=false --lockfile=false .
import { spawn } from "child_process";
import * as readline from "readline";
const proc = spawn('node', ['/tmp/exec.js'], { stdio: 'pipe' });
const readInterface = readline.createInterface({ input: proc.stdout });
const readInterfaceStderr = readline.createInterface({ input: proc.stderr });
await new Promise((resolve, reject) => {
readInterfaceStderr.on('line', (e: string) => {
console.error(e);
stderr += e + "\n";
});
def peek(self, size: int):
b = bytearray()
for i in range(0, min(size, len(self.__buf))):
b.extend(self.__buf[i])
return bytes(b)[:size]
@epicfaace
epicfaace / gist:23308afaa84060688d00f153b5fb69ee
Created May 28, 2021 20:36
print files and names in directory
tail -n +1 * | nc termbin.com 9999
@epicfaace
epicfaace / gist:cb2aec76a7b8fac79c46087fd6d8cbac
Created May 20, 2021 19:50
mac unmount unreadable disk
diskutil list
diskutil unmountDisk force /dev/DRIVENAME
diskutil eraseDisk FAT32 NEWNAME /dev/DRIVENAME
// When gzip files are padded with null bytes at the end (for example,
// bsdtar does this when outputting a .tar.gz to stdout), we should
// just read past the null bytes.
while (strm->avail_in >= 1 && *(strm->next_in) == '\0') {
// printf("\tlarger %d, avail_in %u, total_in %u, next_in %p - %u\n", (uint64_t) ftell_(index->fd, index->f) >= index->compressed_size ? 1 : 0, strm->avail_in, strm->total_in, strm->next_in, *(strm->next_in));
strm->next_in++;
strm->avail_in--;
}
@epicfaace
epicfaace / Dockerfile
Created January 31, 2021 14:42
install htslib with docker
# Install htslib (for bgzip)
RUN mkdir /opt/htslib
RUN curl -L https://github.com/samtools/htslib/releases/download/1.11/htslib-1.11.tar.bz2 --out htslib-1.11.tar.bz2 && \
tar -xf htslib-1.11.tar.bz2 && \
cd htslib-1.11 && \
./configure --disable-bz2 --disable-lzma --prefix=/opt/htslib/ && \
make && \
make install
ENV PATH="${PATH}:/opt/htslib/bin"
@epicfaace
epicfaace / ci.yml
Created August 4, 2020 19:34
encrypting an entire github pages (mkdocs) website with staticrypt - replace MY_PASSWORD and "YOUR SITE NAME HERE"
name: Docs
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
name: Build docs
@epicfaace
epicfaace / paypal form.html
Created July 20, 2020 01:26
stanford daily paypal form
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input name="business" type="hidden" value="coo@stanforddaily.com">
<input name="cmd" type="hidden" value="_donations">
<input name="item_name" type="hidden" value="Stanford Daily Donation">
<input name="item_number" type="hidden" value="From Footer in Page: https://www.stanforddaily.com">
<input name="currency_code" type="hidden" value="USD">
<button name="submit"
style="font-family:'IBM Plex Sans Condensed', sans-serif;text-transform:uppercase;line-height:40px;border:none;border-radius:0;background-color:#8C1515;color:#FFFFFF;paddind-left:20px;paddind-right:20px;height:40px;display:inlineBlock;cursor:pointer;font-size:15px;font-weight:700;letter-spacing:1px;outline:0"
type="submit">Support the Daily</button>
<select name="amount"
@epicfaace
epicfaace / process.py
Created May 20, 2020 15:45
apache beam docs script
import fileinput
PATH = "website/www/site/content/en/documentation/programming-guide.md"
seen = []
STATE_DEFAULT = 0
STATE_IN_HIGHLIGHT = 1
STATE_FINISHED_HIGHLIGHT = 2
STATE_AFTER_HIGHLIGHT_NEWLINE = 3