Skip to content

Instantly share code, notes, and snippets.

# nginx@nginx:~$ cat /etc/nginx/sites-available/outlook.conf
server {
listen 192.168.128.2:80;
server_name yourdomain.com;
return 301 https://yourdomain.com$request_uri;
}
server {
listen 192.168.128.2:443;
@gea0
gea0 / arch-rpi-64-full-disk-encryption-ssh-unlock.md
Last active March 24, 2024 14:36
Tutorial for installing a 64-bit Arch Linux ARM system on the Raspberry Pi 3B+, with an encrypted root filesystem, and the option to remotely unlock it via a pre-boot SSH daemon.

Arch Linux ARM 64 on Raspberry Pi 3 B+ With Full Disk Encryption And SSH Unlock: 2018 Edition

There are multiple ways to get a full disk encrypted arch linux system on raspberry. In this tutorial, we will install a 64-bit arch linux armv8 system, using dropbear as ssh server for remote pre-boot unlocking of the root filesystem. However, it will still be possible to unlock and use the pi as usual, with a keyboard and monitor. We will also create an unencrypted partition in the installation process, usable as a rescue system.

Differences to the 32-bit arch linux arm version:

  • probably better performance
  • can run 64-bit software
  • comes without the proprietary video-driver blobs
@tylerburdsall
tylerburdsall / asynchronous_example.py
Last active December 23, 2022 19:34
Example showing asynchronous HTTP request with Python 3.5.0 + asyncio
import requests
import asyncio
from concurrent.futures import ThreadPoolExecutor
from timeit import default_timer
START_TIME = default_timer()
def fetch(session, csv):
base_url = "https://people.sc.fsu.edu/~jburkardt/data/csv/"
with session.get(base_url + csv) as response:
@stewartjarod
stewartjarod / ZSH Git Bump
Created July 9, 2018 19:26
Bump git version tag by patch, minor, or major
# Usage: `tag M` | `tag maj` | `tag major` || `tag m` | `tag min` | `tag minor` || `tag p` | `tag patch`
function gtag() {
if [ -n $1 ]
then
echo "› Creating tag: v$1"
if git tag -a "v$1" -m "v$1" >/dev/null
then
echo "› Pushing Tag to Upstream"
git push origin --tags
@manics
manics / lsof-parse.py
Created January 25, 2018 16:08
Parse the output of `lsof -F`
#!/usr/bin/env python
# Convert the output of `lsof -F` into PID USER CMD OBJ
import sys
rs = []
pid = -1
cmd = ''
user = ''
for line in sys.stdin:
@seanbehan
seanbehan / app.py
Last active March 13, 2023 04:55
Flask with Django ORM
'''
Run the following commands (bc. gists don't allow directories)
pip install flask django dj-database-url psycopg2
mkdir -p app/migrations
touch app/__init__.py app/migrations/__init__.py
mv models.py app/
python manage.py makemigrations
python manage.py migrate
@ahallora
ahallora / promises.js
Last active February 15, 2020 20:27
How to properly nest functions returning Promises (ECMA6) in node.js (Nested Promises example)
/*
How to properly nest functions returning Promises (ECMA6) in node.js (Nested Promises example)
generated output (with 1 second ticks) =>
p1 function
p2 function
p3 function
p3 done
p2 done
@alexellis
alexellis / timelapse.md
Created March 9, 2017 08:48 — forked from porjo/timelapse.md
ffmpeg time-lapse

Convert sequence of JPEG images to MP4 video

ffmpeg -r 24 -pattern_type glob -i '*.JPG' -i DSC_%04d.JPG -s hd1080 -vcodec libx264 timelapse.mp4

  • -r 24 - output frame rate
  • -pattern_type glob -i '*.JPG' - all JPG files in the current directory
  • -i DSC_%04d.JPG - e.g. DSC_0397.JPG
  • -s hd1080 - 1920x1080 resolution

Slower, better quality

@alexcasalboni
alexcasalboni / amazon-rekognition.md
Last active September 6, 2023 15:20
Amazon Rekognition - Python Code Samples

Amazon Rekognition - Python Code Samples

  1. Labels Detection
  2. Faces Detection
  3. Faces Comparison
  4. Faces Indexing
  5. Faces Search
@Breakthrough
Breakthrough / example_ntfsresize.txt
Last active December 2, 2023 07:39
Bash script to show the progress of ntfsresize while installing Xubuntu (or other Debian-based variants) using the GUi installer and resizing an NTFS partition, only to be frustrated with the lack of zero time estimate or progress indicator.
$> sudo strace -p `pidof "ntfsresize"` -e trace=write 2>&1 | grep 'write(1'
[...]
write(1, " 87.38 percent completed\r", 25) = 25
write(1, " 87.38 percent completed\r", 25) = 25
write(1, " 87.92 percent completed\r", 25) = 25
write(1, " 87.92 percent completed\r", 25) = 25
[...]