Skip to content

Instantly share code, notes, and snippets.

View letranloc's full-sized avatar
👋
playing VS Code

Loc letranloc

👋
playing VS Code
View GitHub Profile
@letranloc
letranloc / install-docker.md
Created October 4, 2022 02:42 — forked from npearce/install-docker.md
Amazon Linux 2 - install docker & docker-compose using 'sudo amazon-linux-extras' command

UPDATE (March 2020, thanks @ic): I don't know the exact AMI version but yum install docker now works on the latest Amazon Linux 2. The instructions below may still be relevant depending on the vintage AMI you are using.

Amazon changed the install in Linux 2. One no-longer using 'yum' See: https://aws.amazon.com/amazon-linux-2/release-notes/

Docker CE Install

sudo amazon-linux-extras install docker
sudo service docker start
@letranloc
letranloc / fix_bitwarden_safari.md
Created April 22, 2022 06:55
Disappearing Safari extensions

If you're just looking for a solution to the issue, here it is: quit Safari, copy the following command to the clipboard, open the Terminal app (located in the Utilities subfolder of the Applications folder), and paste the command.

/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -f -R /Applications/Safari.app

That's it, problem solved! The rest of this blog post will attempt a diagnosis of the problem.

Call the lsregister command above with no arguments to see usage information for the tool. I created an alias in my .bash_profile for convenience.

@letranloc
letranloc / rpi-configure-locales.md
Last active June 25, 2022 09:42 — forked from tomysmile/rpi-configure-locales.md
Raspberry Pi: Reconfigure Locales

Reconfigure your RPi Locales

First you need to install the locales you want:

sudo dpkg-reconfigure locales

Then refresh your current environment:

@letranloc
letranloc / gpg_resign.sh
Created December 28, 2020 07:22 — forked from qdequele/gpg_resign.sh
Resign all my old commits with GPG key
#!/bin/sh
cd $1
git filter-branch --commit-filter '
if [ "$GIT_COMMITTER_EMAIL" = "[email protected]" ]
then
git commit-tree -S "$@";
fi
@letranloc
letranloc / mdm.sh
Created November 15, 2020 02:25
Disable Device Enrollment Notification on Mac - Big Sur
csrutil authenticated-root disable;
diskutil mount /Volumes/Mac;
mount -uv /Volumes/Mac;
cd /Volumes/Mac/System/Library/LaunchAgents;
mkdir tmp;
mv com.apple.ManagedClientAgent.* tmp/;
mv com.apple.mdmclient.* tmp/;
cd ../LaunchDaemons
mkdir tmp;
mv com.apple.ManagedClient.* tmp/;
@letranloc
letranloc / .zshrc
Created October 4, 2020 04:34
Some alias/fn
alias showFiles='defaults write com.apple.finder AppleShowAllFiles YES; killall Finder /System/Library/CoreServices/Finder.app'
alias hideFiles='defaults write com.apple.finder AppleShowAllFiles NO; killall Finder /System/Library/CoreServices/Finder.app'
alias docker-inspect-ip="docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}'"
anaconda3_active()
{
eval "$(/opt/anaconda3/bin/conda shell.zsh hook)"
}
@letranloc
letranloc / fix_certifi.py
Created October 3, 2020 15:12
Fix [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate
import certifi
import os
import os.path
import ssl
import stat
import subprocess
import sys
STAT_0o775 = (stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR
| stat.S_IRGRP | stat.S_IWGRP | stat.S_IXGRP

Disable Device Enrollment Notification on Mac.md

Restart the Mac in Recovery Mode by holding Comment-R during restart

Open Terminal in the recovery screen and type

csrutil disable
@letranloc
letranloc / gist:c9878d029db101eedcadcad5e0ef6a7a
Created April 18, 2017 09:09 — forked from liunian/gist:9338301
Human Readable File Size with PHP
<?php
# http://jeffreysambells.com/2012/10/25/human-readable-filesize-php
function human_filesize($bytes, $decimals = 2) {
$size = array('B','kB','MB','GB','TB','PB','EB','ZB','YB');
$factor = floor((strlen($bytes) - 1) / 3);
return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . @$size[$factor];
}
echo human_filesize(filesize('example.zip'));
@letranloc
letranloc / foldersize.php
Created April 18, 2017 09:09 — forked from eusonlito/foldersize.php
PHP function to get the folder size including subfolders
<?php
function folderSize ($dir)
{
$size = 0;
foreach (glob(rtrim($dir, '/').'/*', GLOB_NOSORT) as $each) {
$size += is_file($each) ? filesize($each) : folderSize($each);
}