Skip to content

Instantly share code, notes, and snippets.

View sirtawast's full-sized avatar

Sampo Tawast sirtawast

  • Motley Agency
  • Helsinki, Finland
View GitHub Profile
@sirtawast
sirtawast / ha-backup-script.sh
Last active January 9, 2024 10:53
Simple SSH script to backup docker composed Home Assistant data to AWS S3 on my Raspberry Pi 4
#/bin/bash
# Assumes aws-cli installed and configured
# Use crontab or whatever you like to automate
HA_BACKUP_DATE=$(date +"%m-%d")
HA_S3_BUCKET_PATH="my-ha-backups/latest/whatever"
cd /home/$USER/homeassistant
docker compose stop
@sirtawast
sirtawast / cam.php
Last active October 24, 2018 10:12
Curl stream and buffer webcam stuff, exit from CURLOPT_WRITEFUNCTION with own function
<?php
class CamStream {
protected $code_done = 99999999;
protected $buffer = "";
public function start_stream($url="https://example.org", $passwd="hello:world") {
$exit_ok = false;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
@sirtawast
sirtawast / keybase.md
Created September 11, 2018 09:13
keybase.md

Keybase proof

I hereby claim:

  • I am sirtawast on github.
  • I am sirtawast (https://keybase.io/sirtawast) on keybase.
  • I have a public key ASCVSERxYhKo7xKpQUtvN0jRluTqX1ajMcJdavXXWrweEAo

To claim this, I am signing this object:

window.i18n = window.i18n || {};
i18n._langCache = {}
i18n._availableLangs = [
'fi',
'en',
]
i18n._updateElements = function () {
@sirtawast
sirtawast / .bash_functions
Last active September 11, 2018 13:01
bash_profile and functions
repeat() {
echo Repeating \"$1\" for every $2 sec
while true
do
eval $1
if [ -n $2 ]; then
sleep $2
else
sleep 5

Keybase proof

I hereby claim:

  • I am sirtawast on github.
  • I am sampohaavisto (https://keybase.io/sampohaavisto) on keybase.
  • I have a public key ASAxQEWFweob4LuwNB2LNf853kbGeIbSGkZr_cb2QU--AQo

To claim this, I am signing this object:

@sirtawast
sirtawast / restore-and-copy-files-from-s3-glacier.sh
Last active May 15, 2024 09:48
AWS: Restore and change S3 storage class
#!/bin/bash
# (should not be run as shell script, the steps take so long)
# Restore/change AWS S3 files from Glacier storage class to STANDARD or STANDARD_IA and copy them in-place to get non-expiring ones
# There wasn't any instructions on how to do this easily so I decided to write them.
# In case you screw things up with lifecycle options etc.
# Procedure might take a while if you have many many files.
# There are three steps:

Keybase proof

I hereby claim:

  • I am sampohaavisto on github.
  • I am sampohaavisto (https://keybase.io/sampohaavisto) on keybase.
  • I have a public key ASAxQEWFweob4LuwNB2LNf853kbGeIbSGkZr_cb2QU--AQo

To claim this, I am signing this object:

@sirtawast
sirtawast / GP7-mac-crash-report
Created August 14, 2017 07:11
GP7 crashes on play when using Bluetooth headphones
Process: GuitarPro7 [16932]
Path: /Applications/Guitar Pro 7.app/Contents/MacOS/GuitarPro7
Identifier: com.arobas-music.guitarpro7
Version: 7.0.5.699 (7.0.5.699)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: GuitarPro7 [16932]
User ID: 501
Date/Time: 2017-08-14 10:06:16.919 +0300
@sirtawast
sirtawast / 0_reuse_code.js
Created April 19, 2017 08:58
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console