Skip to content

Instantly share code, notes, and snippets.

View virtadpt's full-sized avatar
💭
First thing that Microsoft does when buying Github: Add statuses. Whee.

The Doctor virtadpt

💭
First thing that Microsoft does when buying Github: Add statuses. Whee.
View GitHub Profile
@virtadpt
virtadpt / postgres-cheatsheet.md
Created March 20, 2024 19:24 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@virtadpt
virtadpt / you-dont-need-a-blockchain.md
Created August 29, 2023 20:41 — forked from joepie91/you-dont-need-a-blockchain.md
You Don't Need A Blockchain

You don't need a blockchain.

If you're reading this, you probably suggested to somebody that a particular technical problem could be solved with a blockchain.

Blockchains aren't a desirable thing; they're defined by having trustless consensus, which necessarily has to involve some form of costly signaling to work; that's what prevents attacks like sybil attacks.

In other words: blockchains must be expensive to operate, to work effectively. This makes it a last-resort solution, when you truly have no other options available for solving your problem; in almost every case you want a cheaper and less complex solution than a blockchain.

In particular, if your usecase is commercial, then you do not need or want trustless consensus. This especially includes usecases like supply chain tracking, ticketing, and so on. The whole *p

@virtadpt
virtadpt / s3fs.service
Created July 26, 2023 22:29 — forked from klutchell/s3fs.service
systemd unit file for s3fs fuse auto-mount
Description=S3FS FUSE mount
Documentation=https://github.com/s3fs-fuse/s3fs-fuse
Wants=network-online.target
After=network-online.target
AssertPathIsDirectory=/mnt/s3fs
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/s3fs mybucket:/bucketdir /mnt/s3fs -o url=https://nyc3.digitaloceanspaces.com -o use_cache=/tmp -o allow_other -o use_path_request_style -o uid=1000 -o gid=1000
@virtadpt
virtadpt / config_file_and_command_line_arguments.py
Created April 14, 2023 18:55 — forked from gene1wood/config_file_and_command_line_arguments.py
An example of how to use a config file which is overridden by command line arguments in Python.
#!/usr/bin/env python
import ConfigParser
import argparse
import logging
import os
def type_loglevel(level):
try:
result = getattr(logging, level.upper())
@virtadpt
virtadpt / standalone-vivaldi.md
Created April 7, 2022 00:09 — forked from ruario/standalone-vivaldi.md
Unpacks a Vivaldi Linux browser package into a version named directory and creates a startup script that will cause it to save its profile within this directory—Useful for testing or standalone (portable) installs.

Disclaimer: I wrote this script for my own personal use. Completely unofficial and unsupported by Vivaldi Technologies. However, others are welcome to use it at their own risk.

This script converts a Vivaldi browser Linux package into standalone, self-contained install. It lets you use the rpm and deb packages in a similar way to how people generally used the old Opera (Presto) tar packages—for quick testing, without committing to a full, system-wide install. This could be used for testing a specific setup or version, without touching the system wide settings (profile). It can also be used to create a portable (USB install) of Vivaldi that you could store on an external disk, for sharing between computers. A script that supports integration with the desktop environment is also provided.

Usage example:

sh standalone-vivaldi.sh vivaldi-snapshot-1.7.702.1-1.x86_64.rpm

When the script is done you will have a suitably version named directory.

@virtadpt
virtadpt / web-servers.md
Created April 5, 2022 01:17 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@virtadpt
virtadpt / rc-sched-c-pb-3-06-01-2022-1827.txt
Created January 8, 2022 00:32 — forked from alexanderurbs/rc-sched-c-pb-3-06-01-2022-1827.txt
All 'Proud Boy' regional domain names since the insurrection.
// PROUD BOYS REGIONAL DOMAIN NAMES, CREATED SINCE THE INSURRECTION //
inproudboys.com | Squarespace Domains LLC | Creation Date: 2021-01-09T01:38:07Z |
holycityproudboys.com | Epik Inc. | Creation Date: 2021-01-12T04:26:21Z |
proudboysusa.site | eNom, Inc. | Creation Date: 2021-01-14T01:13:00.0Z |
proudboysus.org | DreamHost LLC | Creation Date: 2021-01-14T01:12:45Z |
@virtadpt
virtadpt / 0-go-os-arch.md
Created December 15, 2021 19:32 — forked from asukakenji/0-go-os-arch.md
Go (Golang) GOOS and GOARCH

Go (Golang) GOOS and GOARCH

All of the following information is based on go version go1.17.1 darwin/amd64.

GOOS Values

GOOS Out of the Box
aix
android

SSH agent forwarding and screen

When connecting to a remote server via SSH it is often convenient to use SSH agent forwarding so that you don't need a separate keypair on that server for connecting to further servers.

This is enabled by adding the

ForwardAgent yes

option to any of your Host entries in ~/.ssh/config (or alternatively with the -A option). Don't set this option in a wildcard Host * section since any user on the remote server that can bypass file permissions can now als use keys loaded in your SSH agent. So only use this with hosts you trust.

@virtadpt
virtadpt / systemd_service_hardening.md
Created July 28, 2021 21:37 — forked from ageis/systemd_service_hardening.md
Options for hardening systemd service units

security and hardening options for systemd service units

A common and reliable pattern in service unit files is thus:

NoNewPrivileges=yes
PrivateTmp=yes
PrivateDevices=yes
DevicePolicy=closed
ProtectSystem=strict