Skip to content

Instantly share code, notes, and snippets.

Avatar

Celso Bessa celsobessa

View GitHub Profile
@celsobessa
celsobessa / wowp-batch-image-optimization.sh
Created Sep 11, 2020
Shell script for batch image optimization with Imageoptim from command line as used by WoWPerations team (www.wowperations.com.br)
View wowp-batch-image-optimization.sh
# Batch image optimization with Imageoptim from command line as used by WoWPerations team (www.wowperations.com.br
mdfind -onlyin . "kMDItemPixelWidth<480 && kMDItemContentType=public.jpg" > imagesLess480JPG.txt
mdfind -onlyin . "kMDItemPixelWidth>479 && kMDItemPixelWidth<760 && kMDItemContentType=public.jpg" > imagesLess760JPG.txt
mdfind -onlyin . "kMDItemPixelWidth>759 && kMDItemPixelWidth<1024 && kMDItemContentType=public.jpg" > imagesLess1024JPG.txt
mdfind -onlyin . "kMDItemPixelWidth>1023 && kMDItemPixelWidth<1280 && kMDItemContentType=public.jpg" > imagesLess1280JPG.txt
@celsobessa
celsobessa / String.replaceAll.js
Created Sep 7, 2020
A more elegant implementation of a polyfill for replaceAll method on strings by Chris Ferdinandi (source https://vanillajstoolkit.com/polyfills/stringreplaceall/ )
View String.replaceAll.js
/**
* String.prototype.replaceAll() polyfill
* https://vanillajstoolkit.com/polyfills/stringreplaceall/
* @author Chris Ferdinandi
* @license MIT
*/
if (!String.prototype.replaceAll) {
String.prototype.replaceAll = function(str, newStr){
// If a regex pattern
@celsobessa
celsobessa / git-track-fetch-pull-all-remote-branches.sh
Created Jul 27, 2020
Track, fetch and pull all remote branches on a remote GIT repository
View git-track-fetch-pull-all-remote-branches.sh
# Track, fetch and pull all remote branches on a remote GIT repository
# Source: https://stackoverflow.com/questions/10312521/how-to-fetch-all-git-branches/10312587#10312587
git branch -r | grep -v '\->' | while read remote;
do git branch --track "${remote#origin/}" "$remote";
done
git fetch --all
git pull --all
View 1. Refactoring - Original.js
var isProxyBased = (/S40[\w]{3,5}Browser|Opera\sMini\//i).test(navigator.userAgent);
if (('querySelector' in document && 'localStorage' in window && 'addEventListener' in window && !isProxyBased) || (isIE > 6 && document.getElementById('js-holepunched'))) {
// do stuff
}
@celsobessa
celsobessa / GoogleHackMasterList.txt
Created Jan 27, 2020 — forked from cmartinbaughman/GoogleHackMasterList.txt
The definitive super list for "Google Hacking".
View GoogleHackMasterList.txt
admin account info" filetype:log
!Host=*.* intext:enc_UserPassword=* ext:pcf
"# -FrontPage-" ext:pwd inurl:(service | authors | administrators | users) "# -FrontPage-" inurl:service.pwd
"AutoCreate=TRUE password=*"
"http://*:*@www&#8221; domainname
"index of/" "ws_ftp.ini" "parent directory"
"liveice configuration file" ext:cfg -site:sourceforge.net
"parent directory" +proftpdpasswd
Duclassified" -site:duware.com "DUware All Rights reserved"
duclassmate" -site:duware.com
@celsobessa
celsobessa / wow-tooltip-legacy.0.3.0.js
Last active Dec 1, 2019
WoW Pure CSS Tooltip: an experiment fo pure CSS tooltip on anchor elements
View wow-tooltip-legacy.0.3.0.js
/*!
* WoW Pure CSS Tooltip: an experiment fo pure CSS tooltip on anchor elements.
*
* This script sets the `aria-label` attribute on all anchors if it's not set or empty.
* It uses the contents of the `title` attribute, if present, and remove the title
* attribute in order to avoid the browser native tooltip.
* Meant to be used with the companion WoW Pure CSS Tooltip styles.
*
* See: https://gist.github.com/celsobessa/c98e45d2074be5cd915febfed37feeda
* (c) 2019 Celso Bessa, MIT License, https://www.celsobessa.com.br
@celsobessa
celsobessa / .bashrc
Created Nov 29, 2019
show git branch on your terminal prompt for unix like systems (unix, linux, macOs)
View .bashrc
# Add this to ~/.bashrc
git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
export PS1="[\u@\h \W]\$(git_branch)\$ "
@celsobessa
celsobessa / multiple_ssh_setting.md
Created Nov 2, 2019 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts
View multiple_ssh_setting.md

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@celsobessa
celsobessa / shrinkpdf.sh
Created Jul 19, 2019 — forked from cbessadejusticia/shrinkpdf.sh
shrinkpdf.sh script by Alfred Klomp for optimizing (shrinking) PDF files using Ghostscript
View shrinkpdf.sh
#!/bin/sh
# http://www.alfredklomp.com/programming/shrinkpdf
# Licensed under the 3-clause BSD license:
#
# Copyright (c) 2014, Alfred Klomp
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@celsobessa
celsobessa / sleep-es6.js
Created Jun 14, 2019
sleep() equivalent for vanilla Javascript using ES6 features
View sleep-es6.js
// sleep() equivalent for vanilla Javascript using ES6 features
// created by Dan Dascalescu
// see https://stackoverflow.com/questions/951021/what-is-the-javascript-version-of-sleep/39914235#39914235
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
async function demo() {
console.log('Taking a break...');
You can’t perform that action at this time.