Skip to content

Instantly share code, notes, and snippets.

View synthetic-intelligence's full-sized avatar

synthetic-intelligence

View GitHub Profile
@synthetic-intelligence
synthetic-intelligence / bash scriptable
Created August 4, 2021 13:21
gpg file permissions on macos
# Set ownership to your own user and primary group
chown -R "$USER:$(id -gn)" ~/.gnupg
# Set permissions to read, write, execute for only yourself, no others
chmod 700 ~/.gnupg
# Set permissions to read, write for only yourself, no others
chmod 600 ~/.gnupg/*
@synthetic-intelligence
synthetic-intelligence / scriptable.sh
Last active August 4, 2021 13:20
install amp [ubuntu, debian]
#!/bin/bash
sudo apt-get update -y
sudo apt-get install -y git libxcb1-dev libssl-dev zlib1g-dev cmake python3 cargo
git clone https://github.com/jmacdonald/amp.git
cd amp
@synthetic-intelligence
synthetic-intelligence / More Helpful Commands
Last active June 17, 2024 18:04
Smart Card Config MacOS
# MacOS smartcard
List tokens available in the system
pluginkit -m -p com.apple.ctk-tokens
ex: com.apple.CryptoTokenKit.setoken(1.0)
com.apple.CryptoTokenKit.pivtoken(1.0)
@synthetic-intelligence
synthetic-intelligence / Ubuntu 18.04 setup.md
Created April 23, 2021 17:50 — forked from labbots/Ubuntu 18.04 setup.md
Ubuntu 18.04 Manual partitioning setup with LUKS encryption and LVM - https://labbots.com/ubuntu-18-04-installation-with-luks-and-lvm

Ubuntu 18.04 installation with LUKS and LVM

Installation Process

Pre-installation from live OS

This setup of Ubuntu with LUKS and LVM is tested on Ubuntu 18.04.

Boot Ubuntu from a Live OS and select the option to try Ubuntu without installing. Follow the steps I've outlined below. Let's assume you're installing to /dev/nvme0n1.

  1. Partition the drive with your tool of choice: I used gparted to set mine up.
@synthetic-intelligence
synthetic-intelligence / sudoers
Created January 31, 2021 00:15 — forked from alitoufighi/sudoers
Default /etc/sudoers file (Checked on on Ubuntu 18.04 and Ubuntu 20.04)
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
Defaults mail_badpass
@synthetic-intelligence
synthetic-intelligence / bottle_hello.py
Created January 27, 2021 09:37 — forked from drgarcia1986/bottle_hello.py
Python HelloWorld (WebFrameworks) Collection
# -*- coding: utf-8 -*-
from bottle import route, run
@route('/')
def index():
return '<h1>Hello World/h1>'
run(host='localhost', port=8000)
@synthetic-intelligence
synthetic-intelligence / pyargs.md
Created January 27, 2021 09:35 — forked from dideler/pyargs.md
Parsing Command-Line Argument in Python

Command-line arguments in Python show up in sys.argv as a list of strings (so you'll need to import the sys module).

For example, if you want to print all passed command-line arguments:

import sys
print(sys.argv)  # Note the first argument is always the script filename.

Command-line options are sometimes passed by position (e.g. myprogram foo bar) and sometimes by using a "-name value" pair (e.g. myprogram -a foo -b bar).

Inspired by this article. Neat tricks for speeding up integer computations.

Note: cin.sync_with_stdio(false); disables synchronous IO and gives you a performance boost. If used, you should only use cin for reading input (don't use both cin and scanf when sync is disabled, for example) or you will get unexpected results.

Multiply by a power of 2

x = x << 1; // x = x * 2

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@synthetic-intelligence
synthetic-intelligence / iterm2-solarized.md
Created January 27, 2021 09:34 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k