Skip to content

Instantly share code, notes, and snippets.

Avatar
🤓
emphatically trying not to use github as icq

Nick kousu

🤓
emphatically trying not to use github as icq
View GitHub Profile
@kousu
kousu / README.md
Created Apr 11, 2021
dockerize for travis-ci
View README.md
@kousu
kousu / README.md
Last active Apr 8, 2021
extract functions
View README.md

Extract an indented block from a file, starting from a given header line.

Usage: extract.awk HEADER file

e.g.

$ ./extract.awk a t
   a() {
@kousu
kousu / sanitize.py
Created Apr 5, 2021
Sanitize a file path against directory traversal in python
View sanitize.py
import os.path
def sanitize_path(path):
"""
Sanitize a path against directory traversals
Based on https://stackoverflow.com/questions/13939120/sanitizing-a-file-path-in-python.
>>> sanitize_path('../test')
'test'
View README.md

showterm.io

Installation:

mkdir -p ~/.local/bin
curl https://gist.githubusercontent.com/kousu/855c164979af078f623fd44f0e1b5350/raw/6536924551c9de7143492c407f4e584389ba3f9f/showterm > .local/bin/showterm
chmod +x .local/bin/showterm
@kousu
kousu / README.md
Created Mar 19, 2021
Repo splitting with git filter-repo
View README.md

To split the GUI plugin, spread over two branches (1 2) and two folders (shimmingtoolbox/gui/, shimmingtoolbox/fsleyes-plugin-shimming-toolbox), out from git@github.com:shimming-toolbox/shimming-toolbox.git to git@github.com:shimming-toolbox/fsleyes-plugin-shimming-toolbox.git:

  1. sudo pacman -S git-filter-repo [or your local option]
@kousu
kousu / README.md
Created Nov 28, 2020
http cert pinning
View README.md

Generate certificate pins for your apps.

View xmpp-vs-signal.md

For all of you wanting this feature there's a great option out there if you're willing to step beyond Signal: Conversations. There's no primary/secondary distinction: it does true-multi-device multi-key encryption (they adopted libsignal and built on it and I'm very grateful that OWS developed and released it so it could be built upon), as well as video chat, file attachments (encrypted, of course), and cross-device history syncing, and all that at 1/3rd the size of Signal, and without a dependency on push notifications. And you can pretty easily set up alt identities and use them on the same devices so there's no need to worry about [giving out a private number](https://www.vice.com/en_us/article/9kaxge/how-to-use-signal-without-giving-out-your-phone-number-a-gender

View dokucp.sh
#!/usr/bin/env bash
# upload a file to neuropoly's wiki's filestore at https://www.neuro.polymtl.ca/lib/exe/mediamanager.php
# public domain
# author: nguenthe@uwaterloo.ca
#
# TODO: be fully scp compatible: we should be able to specify the target filename, disambiguating between DESTs ending in / or not
set -eo pipefail # crash on sub-errors; pipefail is a bashism, but sooo useful
set -u # crash on missing vars