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 / angularjs_directive_attribute_explanation.md
Created May 28, 2016 06:24 — forked from CMCDragonkai/angularjs_directive_attribute_explanation.md
JS: AngularJS Directive Attribute Binding Explanation

AngularJS Directive Attribute Binding Explanation

When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.

  1. Raw Attribute Strings

    <div my-directive="some string" another-param="another string"></div>
@letranloc
letranloc / font-awesome.php
Created January 16, 2017 09:38 — forked from justintadlock/font-awesome.php
PHP array of Font Awesome icons.
<?php
// Font Awesome v. 4.6.
function jt_get_font_icons() {
return array(
'fa-glass' => 'f000',
'fa-music' => 'f001',
'fa-search' => 'f002',
'fa-envelope-o' => 'f003',
@letranloc
letranloc / npm-f3-install.sh
Created February 15, 2017 04:40 — forked from SuperPaintman/npm-f3-install.sh
NPM install for low RAM machins. And "npm install ... killed" problem
#!/bin/bash
#
# Author: SuperPaintman <[email protected]>
#
###
# Constants
###
RETVAL=0
@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);
}
@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'));

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 / 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
@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 / 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 / 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