Skip to content

Instantly share code, notes, and snippets.

View atenni's full-sized avatar
🤷‍♂️

Andrew Tennikoff atenni

🤷‍♂️
  • Sydney, Australia
  • 01:12 (UTC +10:00)
View GitHub Profile
@atenni
atenni / README.md
Last active April 24, 2024 01:36
How to permalink to a gist's raw file

Problem: When linking to the raw version of a gist, the link changes with each revision.

Solution:

To return the first file from a gist: https://gist.github.com/[gist_user]/[gist_id]/raw/

To get a file from multi–file gist: https://gist.github.com/[gist_user]/[gist_id]/raw/[file_name]

@atenni
atenni / README.md
Created September 11, 2023 05:15 — forked from robertpainsi/README.md
How to reopen a pull-request after a force-push?

How to reopen a pull-request after a force-push?

Precodinitions

  • You need the rights to reopen pull requests on the repository.
  • The pull request hasn't been merged, just closed.

Instructions

  1. Write down the current commit hash of your PR-branch git log --oneline -1 <PR-BRANCH>
  2. Write down the latest commit hash on github before the PR has been closed.
  3. git push -f origin :
@atenni
atenni / ffmpeg-options.txt
Created April 13, 2016 23:55
Reference: ffmpeg options (because I always forget)
$ ffmpeg --help
ffmpeg version N-78304-g37db3e8 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 5.3.0 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfi
g --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --
enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libm
p3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --en
able-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --ena
ble-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-lib
@atenni
atenni / Postgres_SQL_Dump.md
Last active April 26, 2023 16:48
A quick reminder on how to perform a Postgres SQL dump.

Use pg_dump to create a dev copy of a DB

Steps

  1. Perform pg_dump -> gzip output -> save

    • pg_dump DB_NAME --username=DB_USER | gzip > /location/to/backup.gz
    • Note: if you get "FATAL: Ident authentication failed..." you'll need to look in pg_hba.conf. See below for more info.
  2. Unzip -> import into new database

@atenni
atenni / Bootstrap_RaspberryPi_without_USB_keyboard_mouse.md
Last active February 23, 2023 10:56
Steps to bootstrap a Raspberry Pi (3) without a USB keyboard or mouse, and a WiFi connection only.

Bootstrap Raspberry Pi without a USB keyboard or mouse (2019)

Assumes you have a laptop, WiFi only (no LAN), and a HDMI monitor you can use with the Pi.

Credit: most of this info was found here.

Add OS image to SD card

  1. Download the latest image of Raspbian.
@atenni
atenni / Feedback.md
Last active August 15, 2020 16:40
Code review for colleague

Overall this is pretty impressive for someone just starting out - well done!

Here's a few overall design comments. I'll include technical feedback as comments directly in Updated-PythonPractice.py

DRY Principle - Don't Repeat Yourself.

When coding you don't want to write the same piece of functionality twice. In longer programs this type of duplication makes it hard to follow the flow of the

Recipe: calculate SHA256 hash of file in Python

import hashlib

FILENAME = ''
hasher = hashlib.sha256()

with open(FILENAME, "rb") as f:
 for byte_block in iter(lambda: f.read(4096),b""):
@atenni
atenni / Quickstart - PyCharm Docker.md
Last active July 25, 2018 05:31
Quickstart: Docker backed PyCharm project

Docker backed Python project using PyCharm

This quickstart assumes OS X 10.13, PyCharm 2018.1, Docker 18.03, and Python 3.7.

  1. Start Docker and PyCharm
  2. Create new project - "Pure Python"
  3. Set project name and temporarily set the project interpreter to Existing interpreter > Python 3.x (local)
  4. Create Dockerfile and/or docker-compose.yml (see samples of each below),
@atenni
atenni / s3_multipart_upload.py
Created May 27, 2018 11:51 — forked from teasherm/s3_multipart_upload.py
boto3 S3 Multipart Upload
import argparse
import os
import boto3
class S3MultipartUpload(object):
# AWS throws EntityTooSmall error for parts smaller than 5 MB
PART_MINIMUM = int(5e6)
@atenni
atenni / link_checker.py
Last active October 25, 2017 21:52
A dirty script to spider a base url, iterate over internal link and store the response code and url in link_checker_results.csv. Mainly used for testing.