Skip to content

Instantly share code, notes, and snippets.

View shawnhank's full-sized avatar

Shawn Hank shawnhank

View GitHub Profile
@dardo82
dardo82 / safari-favicons.sh
Last active February 16, 2024 02:40
Fix Safari FavIcons
#!/bin/zsh
# Fix Safari Favorites Icons
CS="cache_settings"; TIC="Touch Icons Cache"; DIR="$HOME/Library/Safari/$TIC/Images"
DB="$DIR/../${${TIC// }%%s*}${${(C)CS}//_}.db"; SQL=$(sqlite3 "$DB" "SELECT host FROM $CS")
sqlite3 "$DB" "UPDATE $CS SET ${${${(L)TIC// /_}#*_}//s/_is_in}=1, download_status_flags=1"
for png in "$1"/*.png; do URL="$(plutil -convert xml1 -o - "$DIR/../../Bookmarks.plist" | \
awk -F '[</>]' -v name="${${png##*/}%%.*}" '$3~name{getline;getline;getline;print $5}')"; \
cp -f -v "$png" "$DIR/${(U)$(md5 -q -s $URL)}.png"; done; chflags -v uappnd $DIR $DB*
@ammgws
ammgws / letsencrypt-acme-guide.md
Last active July 23, 2023 17:19
Using acme.sh script to renew LetsEncrypt certs using non-standard SSL port

1. Install acme.sh shell script

git clone https://github.com/Neilpang/acme.sh.git
cd acme.sh
./acme.sh --install

Optionally, set the home dir and/or account info (if already have one).
If was previously using LetsEncrypt's certbot, can probably get account info from /etc/letsencrypt/accounts/acme-v01.api.letsencrypt.org/directory/*/regr.json.

@zhen-huan-hu
zhen-huan-hu / homelab.markdown
Last active October 10, 2023 04:44
Personal Notes on Home Lab Administration

Personal Notes on Home Lab Administration

This is a collection of personal notes on self-hosted home lab administration. This reference assumes the underlying OS is Ubuntu Server 22.04.

Installing a New Hard Drive

List block devices and get UUIDs for the partitions

It is recommended to use lsblk command to get information about block devices rather than blkid. lsblk provides more information, better control on output formatting and it does not require root permission to get actual information.

@attacus
attacus / riot-matrix-workshop.md
Last active March 13, 2024 00:16
Create your own encrypted chat server with Riot and Matrix

This guide is unmaintained and was created for a specific workshop in 2017. It remains as a legacy reference. Use at your own risk.

Running your own encrypted chat service with Matrix and Riot

Workshop Instructor:

This workshop is distributed under a CC BY-SA 4.0 license.

What are we doing here?

@dduvnjak
dduvnjak / add_cloudflare_ips.sh
Last active May 6, 2024 15:06
Add CloudFlare IP addresses to an EC2 Security Group using awscli
# first we download the list of IP ranges from CloudFlare
wget https://www.cloudflare.com/ips-v4
# set the security group ID
SG_ID="sg-00000000000000"
# iterate over the IP ranges in the downloaded file
# and allow access to ports 80 and 443
while read p
do
@DuncanIdahoCT
DuncanIdahoCT / Aeon HEM Gen5 (zw095-a).groovy
Last active September 8, 2023 18:32
Aeon HEM Gen5(zwave plus)
/*
* Aeon HEM Gen5(zwave plus)
*
* Copyright 2016 Dillon A. Miller
*
* v0.8 of Aeon HEM Gen5(zwave plus) code, released 04/15/2016 for Aeotec Model zw095-a
* This Gen5 device handler is not backward compatible with the Aeon V1 or V2 device. If your model number is not zw095-a, don't use it.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at:
#cloud-config
ssh_authorized_keys:
- ssh-rsa xyz
write_files:
- path: /var/lib/rancher/conf/cloud-config.yml
permissions: "0644"
owner: root
content: |
#cloud-config
ssh_authorized_keys:
@DanSkeel
DanSkeel / private.xml
Last active November 30, 2022 21:39
Settings for Karabiner to enable Shift+Enter shortcut for newline in Messages app
<?xml version="1.0"?>
<!-- Documentation: https://pqrs.org/osx/karabiner/xml.html.en -->
<root>
<appdef>
<appname>Messages</appname>
<equal>com.apple.iChat</equal>
</appdef>
<item>
<name>Enable Shift+enter newline shortcut in Messages app</name>
<identifier>private.Messages.NewLine</identifier>
@chrwei
chrwei / gist:42f8bbb687290b04b598
Last active January 27, 2020 03:21
How To install SCST on Ubutuntu 15.04 with in-tree kernel patches

These instructions are for SCST trunk as of 5/25/2015 and Ubuntu server 15.04 with 3.19.0-18-generic amd64 kernel. adjust paths as needed

SCST official site

commands all relative to the build dir of your choice and mostly dependent on the command above it

get latest SCST:

 svn co https://scst.svn.sourceforge.net/svnroot/scst/trunk scst

make kernel patch:

@benkulbertis
benkulbertis / cloudflare-update-record.sh
Last active April 28, 2024 16:35
Cloudflare API v4 Dynamic DNS Update in Bash
#!/bin/bash
# CHANGE THESE
auth_email="user@example.com"
auth_key="c2547eb745079dac9320b638f5e225cf483cc5cfdda41" # found in cloudflare account settings
zone_name="example.com"
record_name="www.example.com"
# MAYBE CHANGE THESE
ip=$(curl -s http://ipv4.icanhazip.com)