Skip to content

Instantly share code, notes, and snippets.

View faun's full-sized avatar
🌵

Faun faun

🌵
View GitHub Profile
@faun
faun / character_set_and_collation.rb
Created October 21, 2024 17:30 — forked from tjh/character_set_and_collation.rb
Convert all Rails table column collation and character set
#!/usr/bin/env ruby
# Put this file in the root of your Rails project,
# then run it to output the SQL needed to change all
# your tables and columns to the same character set
# and collation.
#
# > ruby character_set_and_collation.rb
DATABASE = ''
@faun
faun / controller-gen.txt
Created March 31, 2022 22:53 — forked from jenting/controller-gen.txt
controller gen help
CRD
+groupName package
=<string> specifies the API group name for this package.
+kubebuilder:deprecatedversion type
marks this version as deprecated.
[warning=<string>]
@faun
faun / README.md
Created December 1, 2021 21:59 — forked from jonico/README.md
How to create an RDS database that is suitable for PlanetScale's import feature

MySQL on RDS configured for import to PlanetScale example

This folder contains an example Terraform configuration that deploys a MySQL database - using RDS in an Amazon Web Services (AWS) account - that is properly configured for PlanetScale's DB import feature.

It will make sure that the RDS database has the binlog exposed, gtid-mode set to ON and is using ROW-based replication. All these are pre-requisites for imports to work without zero downtime.

If you are going to write a lot of data in your database in a very short amount of time, don't forget the only manual step after the Terraform setup.

@faun
faun / generate_yubikey_keys.sh
Last active September 1, 2021 11:31
Configure Yubikey and generate PKCS #11 keys
echo "Setting the YubiKey to be a U2F device and behave as a smart card"
ykpersonalize -m 86
if [[ $# -eq 1 ]] && [[ "$1" = "first-run" ]]
then
echo "Please set a new managment key:"
yubico-piv-tool -aset-mgm-key || true
echo "Please set the device PIN:"
yubico-piv-tool -achange-pin -P123456
@faun
faun / open_pull_request.sh
Created June 29, 2017 16:37
Open a given pull request in the browser. Depends on hub and fzf
hub browse -- pull/$(hub issue --include-pulls | fzf | awk '{print $1}' | sed -e 's/^#//')
@faun
faun / Github Flavored Markdown.md
Created September 14, 2016 18:10 — forked from stevenyap/Github Flavored Markdown.md
Github Flavored Markdown cheatsheet

Github Flavored Markdown (GFMD) is based on Markdown Syntax Guide with some overwriting as described at Github Flavored Markdown

Text Writing

It is easy to write in GFMD. Just write simply like text and use the below simple "tagging" to mark the text and you are good to go!

To specify a paragraph, leave 2 spaces at the end of the line

Headings

Large Object Motions:
(
)
{
}
[[
[]
][
]]
[m
@faun
faun / smb_fs_automount.sh
Last active July 8, 2020 10:50
Script to mount remote SMB volume using password stored in Mac OS keychain without needing admin or sudo priveliges
#!/usr/bin/env bash
# Fetch the password from the keychain if it exists
PASSWORD_ENTERED=false
ACCOUNT_NAME='login'
SERVICE_NAME='mount_volume'
PASSWORD=$(
security 2> /dev/null \
find-generic-password -w \
-a $ACCOUNT_NAME \
@faun
faun / pallindrome.rb
Created December 30, 2014 23:49
Pallindromes
class String
def pallindrome?
string = self.downcase.gsub(/[^0-9a-z]/i,'')
return false if string.length <= 1
string.reverse == string
end
def collect_possible_starts_and_end
#{ a: [0, 1], b: [3], c: [1,4,6]}