Skip to content

Instantly share code, notes, and snippets.

@furkan3ayraktar
furkan3ayraktar / LambdaEdgeIndexRedirect.js
Created March 31, 2018 13:44
Redirect requests to index.html within same folder from CloudFront with Labda@Edge.
const path = require('path');
exports.handler = (event, context, callback) => {
const { request } = event.Records[0].cf;
console.log('Request URI: ', request.uri);
const parsedPath = path.parse(request.uri);
let newUri;
@afunTW
afunTW / README.md
Last active May 6, 2025 18:00
sample code for icalendar and google calendar API

Intro

Thers's some MS-defined column in .ics that will be ignored when import .ics to google calendar. We can self modified those value and insert/update the google calendar by google calendar API.

  • icalendar: parse the .ics file
  • google-api-python-client: google calendar API

Usage

@yvh
yvh / README.md
Last active October 7, 2024 08:53
English language locale for Belgium (Ubuntu, Debian, ...)

English language locale for Belgium on Ubuntu, Debian and others linux systems

sudo cp en_BE /usr/share/i18n/locales/en_BE
sudo localedef -i en_BE -c -f UTF-8 en_BE
echo "en_BE.UTF-8 UTF-8" | sudo tee -a /etc/locale.gen
sudo locale-gen

Maybe also change files in /var/lib/locales/supported.d/

@ajeetraina
ajeetraina / docker-compose.yml
Created October 29, 2017 12:21
Docker Compose File for MacVLAN Network Driver ( Single Node)
version: '3.3'
services:
db:
image: mysql:5.7
volumes:
- db_data:/var/lib/mysql
restart: always
networks:
- myvlan

Exporting your 2FA tokens from Authy to transfer them into another 2FA application

IMPORTANT - Update regarding deprecation of Authy desktop apps

Past August 2024, Authy stopped supported the desktop version of their apps:
See Authy is shutting down its desktop app | The 2FA app Authy will only be available on Android and iOS starting in August for details.

And indeed, after a while, Authy changed something in their backend which now prevents the old desktop app from logging in. If you are already logged in, then you are in luck, and you can follow the instructions below to export your tokens.

If you are not logged in anymore, but can find a backup of the necessary files, then restore those files, and re-install Authy 2.2.3 following the instructions below, and it should work as expected.

@x-drum
x-drum / ssh-agent-shutdown.sh
Last active May 17, 2022 16:43
ssh-agent: Archlinux plasma 5
#!/bin/sh
## place in ~/.config/plasma-workspace/shutdown/ssh-agent-shutdown.sh
## exec order: "kde shutdown"
$SSH_AGENT_PID" ] || eval "$(ssh-agent -k)"
@pedroxs
pedroxs / jq-filters.sh
Last active March 22, 2025 00:02
jq - recursive search for keys containing "string" stripping empty results
# recursive search for keys containing "string" stripping empty results
jq '.. | objects | with_entries(select(.key | contains("ftp"))) | select(. != {})'
# same, but output propper array
jq '[ .. | objects | with_entries(select(.key | contains("ftp"))) | select(. != {}) ]'
# or
jq 'map( .. | objects | with_entries(select(.key | contains("ftp"))) | select(. != {}) )'
# transform input from {type: a, amount: 1} to {a: 1} and sum all values by type
jq '[ .[] | {(.type): .amount} ] | map(to_entries) | add | group_by(.key) | map({key: .[0].key, value: map(.value) | add}) | from_entries'
@stevejenkins
stevejenkins / unifi_ssl_import.sh
Last active August 30, 2021 03:57
Import and use SSL certificates (including Let's Encrypt) with the Ubiquiti UniFi Controller on Unix/Linux Systems
# MOVED TO https://github.com/stevejenkins/unifi-linux-utils
@dstapp
dstapp / zfs-backup.sh
Created March 28, 2016 18:50
Simple backup script utilizing rsync and ZFS snapshots
#!/usr/bin/env bash
#
# zfs-backup.sh
#
# Simple backup script utilizing rsync and ZFS snapshots.
#
# rsync must be installed both on the server and the client.
# ssh must be installed on the client.
# bash must be installed on the server.