Skip to content

Instantly share code, notes, and snippets.

View ross-spencer's full-sized avatar
💭
🖖

Ross Spencer ross-spencer

💭
🖖
View GitHub Profile
@ross-spencer
ross-spencer / asciihist.py
Created January 16, 2025 17:42 — forked from bgbg/asciihist.py
ASCII histograms
from __future__ import print_function
import numpy as np
def asciihist(it, bins=10, minmax=None, str_tag='',
scale_output=30, generate_only=False, print_function=print):
"""Create an ASCII histogram from an interable of numbers.
Author: Boris Gorelik [email protected]. based on http://econpy.googlecode.com/svn/trunk/pytrix/pytrix.py
License: MIT
"""
ret = []
@ross-spencer
ross-spencer / sqlbuddy.py
Created December 30, 2024 07:41 — forked from angea/sqlbuddy.py
Scans SQLite files for known features (UserVersion, AppId, Schema...)
#!/usr/bin/env python3
# Scans SQLite files for known features (UserVersion, AppId, Schema...)
# Ange Albertini 2024
import argparse
import hashlib
import sqlite3
import sys
user_versions = {
@ross-spencer
ross-spencer / imagetest.sh
Created November 22, 2024 20:19 — forked from kumbasar/imagetest.sh
How To Create a NTFS Image File in Linux
#!/bin/bash
set -x
image="test.img"
label="test"
mntdir=`mktemp -d`
sudo dd status=progress if=/dev/zero of=$image bs=6M count=1000 && sync
echo 'type=7' | sudo sfdisk $image

Note

Going to move development to this repo to make PRs easier to manage: https://github.com/brianckeegan/Post_2024_News

Post-2024 news

Mainstream media failed to hold Trump to account over the course of the 2024 presidential campaign through "view from nowhere" centrism and false equivalencies between both campaigns.

Here is a list of news organizations, newsletters, and writers that are audience-funded and/or non-profits committed to independent and investigative journalism.

Rules

  • No centrist contrarians or right-wing authors
@ross-spencer
ross-spencer / logger-rsyslog.py
Created July 12, 2024 08:48 — forked from danielkraic/logger-rsyslog.py
python app with loggin to rsyslog
"""
rsyslog config: /etc/rsyslog.d/my-sample.conf:
$template AppLogFormat, "%TIMESTAMP:::date-pgsql%%TIMESTAMP:27:32:date-rfc3339%(%syslogseverity-text%)%msg%\n"
if $app-name == 'my-sample-app' then -/var/log/my-sample-app/app.log;AppLogFormat
& ~
"""
from __future__ import print_function

top (the UNIX process inspector) cheat sheet

This is a list of the most helpful keyboard commands I use within top.

The basics

h shows help on interactive commands. Also see the top manual page

q to quit the program.

@ross-spencer
ross-spencer / bash_strict_mode.md
Created February 10, 2024 04:31 — forked from mohanpedala/bash_strict_mode.md
set -e, -u, -o, -x pipefail explanation
@ross-spencer
ross-spencer / PAB_setup.md
Created January 25, 2023 17:43 — forked from mikekeke/PAB_setup.md
PAB setup

Hosted PAB setup

This document describes how to prepare hosted PAB deployment from scratch that can operate on Alonzo purple testnet.

The following required to be run on host machine to use PAB with contracts in hosted scenario on testnet (for 2020-11-05 PAB Release):

  • Cardano node connected to Alonzo testnet
  • cardano wallet connected to node
  • chain-index connected to node
  • PAB executable connected to node, cardano-wallet and chain-index

Note: we are using somewhat more involved setup with a bit custom docker compose, and wallet and chain-index being built from sources, but there is ready to go node+wallet docker solution available

@ross-spencer
ross-spencer / pcdm_filesets_testing.md
Created December 2, 2021 09:00 — forked from cmharlow/pcdm_filesets_testing.md
Testing PCDM modeling with Fileset options (PCDM PRs #68, #69) for existing Cornell use cases
@ross-spencer
ross-spencer / latency.txt
Created February 23, 2021 13:06 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD