Skip to content

Instantly share code, notes, and snippets.

@TrillCyborg
TrillCyborg / mastodon-docker-setup.md
Last active June 30, 2024 02:37
Mastodon Docker Setup

Mastodon Docker Setup

Setting up

Clone Mastodon's repository.

# Clone mastodon to ~/live directory
git clone https://github.com/tootsuite/mastodon.git live
# Change directory to ~/live

cd ~/live

@johnwargo
johnwargo / relay-test.py
Last active January 15, 2024 22:00
Simple Python app for controlling a relay through an GPIO Zero Output device
#!/usr/bin/python
# A simple Python application for controlling a relay board from a Raspberry Pi
# The application uses the GPIO Zero library (https://gpiozero.readthedocs.io/en/stable/)
# The relay is connected to one of the Pi's GPIO ports, then is defined as an Output device
# in GPIO Zero: https://gpiozero.readthedocs.io/en/stable/api_output.html#outputdevice
import sys
import time
@zed
zed / leapseconds.py
Last active June 12, 2024 13:52
leap seconds
#!/usr/bin/env python
"""Get TAI-UTC difference in seconds for a given time using tzdata.
i.e., find the number of seconds that must be added to UTC to compute
TAI for any timestamp at or after the given time[1].
>>> from datetime import datetime
>>> import leapseconds
>>> leapseconds.dTAI_UTC_from_utc(datetime(2005, 1, 1))
datetime.timedelta(seconds=32)
@jeremiahajohnson
jeremiahajohnson / GPStoUTC.py
Last active April 3, 2022 02:33
Python function to take GPS week and GPS seconds and return a UTC datetime string in the format "YYYY-MM-DD HH:MM:SS"
def weeksecondstoutc(gpsweek,gpsseconds,leapseconds):
import datetime, calendar
datetimeformat = "%Y-%m-%d %H:%M:%S"
epoch = datetime.datetime.strptime("1980-01-06 00:00:00",datetimeformat)
elapsed = datetime.timedelta(days=(gpsweek*7),seconds=(gpsseconds+leapseconds))
return datetime.datetime.strftime(epoch + elapsed,datetimeformat)
weeksecondstoutc(1811,164196.732,16) ## --> '2014-09-22 21:36:52'
@pspeter3
pspeter3 / minecraft.xboxdrv
Created July 31, 2011 08:37
Use with xboxdrv -c minecraft.xboxdrv
# Supports the default controls in the way I thought was logical.
#
# A is jump
# B is sneak
# X is drop
# Y is chat
# Scroll with the DPAD
# RT is left click
# LT is right click
# Left joystick is WASD
@kogakure
kogakure / .gitignore
Last active December 17, 2023 08:21
Git: .gitignore file for LaTeX projects
*.acn
*.acr
*.alg
*.aux
*.bak
*.bbl
*.bcf
*.blg
*.brf
*.bst