Skip to content

Instantly share code, notes, and snippets.

View phenotypic's full-sized avatar
📡
Sent from my iPhone

Tom phenotypic

📡
Sent from my iPhone
View GitHub Profile
@phenotypic
phenotypic / TranscodeDNA.py
Last active July 31, 2020 22:15
Simple encoder/decoder for DNA and UTF-8
dnaBin = {'A': '00', 'T': '01', 'C': '10', 'G': '11'}
def selectionMenu():
response = input('\nWould you like to encode or decode DNA? [e/D]: ').lower()
if response == 'e':
text = input('\nInput text to encode: ')
encodeDNA(text)
elif response == 'd':
text = input('\nInput DNA to decode: ')
@phenotypic
phenotypic / ffmpeg.md
Last active March 4, 2024 01:42
FFmpeg cheat sheet

FFmpeg commands

A handy cheat sheet for various FFmpeg commands I use frequently.

H.265/HEVC encoding

ffmpeg -i input -c:v libx265 -c:a copy output
@phenotypic
phenotypic / WiFiScan.py
Last active April 29, 2020 20:43
Python Wi-Fi scanner for macOS
import subprocess
import re
from prettytable import PrettyTable
airport = '/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport'
print('Scanning for networks...\n')
scan = subprocess.run(['sudo', airport, '-s'], stdout=subprocess.PIPE)
scan = scan.stdout.decode('utf-8')
@phenotypic
phenotypic / eslintrc.json
Last active January 20, 2021 00:02
Global ESLint configuration file
{
"parserOptions": {
"ecmaVersion": 2021,
"ecmaFeatures": {
"jsx": true
},
"sourceType": "module"
},
"env": {
@phenotypic
phenotypic / Secure-SSH-All.md
Last active July 31, 2020 15:54
SSH best practices

Safe SSH setup for your Pi

If you expose your Pi's SSH service to the web, you should seriously consider the security implications.

It is common for people to run mass port scans looking for open SSH ports and then run brute-force attacks against these ports hoping to crack the password and gain access to the system.

Follow this guide for a secure SSH setup.

Index

@phenotypic
phenotypic / FizzBuzz.md
Last active July 31, 2020 15:53
FizzBuzz in multiple languages

FizzBuzz

My aim was to make multiple variations of the FizzBuzz game in various programming languages. Each language has different approaches ranging in simplicity.

Bash

Approach 1

Test for each of the three possibilities, echoing the number if none of them are met:

@phenotypic
phenotypic / Raspberry-Pi-Homebridge.md
Last active November 15, 2021 17:10
Homebridge on a Raspberry Pi

Homebridge on a Raspberry Pi

This gist walks you through the method I used for setting up Homebridge on my Raspberry Pi 3 Model B. Many aspects are taken from the original Homebridge wiki. Note that steps can vary between Raspberry Pi models and as packages are updated or changed.

Index

Mandatory

@phenotypic
phenotypic / NodeMCU-Check.sh
Last active May 11, 2019 22:38
Simple script to check if your NodeMCUs are reachable on your network
#! /bin/bash
#DESCRIPTION: Pings all the IPs in the list and reports whether or not they are reachable
GREEN='\033[1;32m'
RED='\033[1;31m'
BLUE='\033[1;34m'
THICK='\033[1;37m' #For white backgrounds, use: THICK='\033[1;30m'
NC='\033[0m'
@phenotypic
phenotypic / NodeMCU-Flash.md
Last active May 25, 2019 20:17
Flashing a NodeMCU using the Arduino IDE (macOS)

Flashing a NodeMCU using the Arduino IDE (macOS)

Watch a demo here

Note: These steps will only work if your NodeMCU has the CP2102 chip onboard (instead of the CH340G chip).

  1. Have the .ino script included in the repository downloaded and ready to go.

  2. Download and install the Arduino IDE from here.