Skip to content

Instantly share code, notes, and snippets.

🏄‍♀
Focused when not in the beach 💃

Pedro de Carvalho LC43

🏄‍♀
Focused when not in the beach 💃
Block or report user

Report or block LC43

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@LC43
LC43 / git_diff_exclude.sh
Last active Jan 20, 2020
git diff between two branches, ignoring some paths
View git_diff_exclude.sh
## note that there's two notations: :(exclude) or :!
git diff <branch1> <branch2> -- ':(exclude)*/vendor/*' ':(exclude)*/assets/*' ':!*/build/*' ':!*.lock'
@LC43
LC43 / lr.js
Last active Jan 18, 2019
translate lr
View lr.js
auth.monaSdk.core.LRObject.$hooks.call(
'mapValidationMessages',
{
rule: "required",
message: i18n.t('account.profileeditor.required'), // "The %s field is required."
}, {
rule: "valid_email",
message: i18n.t('account.profileeditor.valid_email'), // "The %s field must contain a valid email address."
}, {
rule: "min_length",
@LC43
LC43 / send_workspace_next.sh
Last active Jan 10, 2019
Send window to next workspace
View send_workspace_next.sh
#!/bin/bash
## workspace Number ( count )
WS_N=$(wmctrl -d | wc -l)
## workspace ID
WS_ID=$(wmctrl -d | grep '*' | cut -d ' ' -f1)
## next workspace id ( loops around )
NEXT_ID=$(( ( $WS_ID + 1 ) % $WS_N ));
@LC43
LC43 / end_workspace_prev.sh
Last active Jan 10, 2019
Send window to previous workspace
View end_workspace_prev.sh
#!/bin/bash
## workspace Number ( count )
WS_N=$(wmctrl -d | wc -l)
## workspace ID
WS_ID=$(wmctrl -d | grep '*' | cut -d ' ' -f1)
## previous workspace id ( loops around )
PREV_ID=$(( ( $WS_ID - 1 ) % $WS_N ));
@LC43
LC43 / example_poor_docs.php
Last active Aug 26, 2018
Example of poor documentation. It documents the part that is easier to read, but fails to explain why only future dates are important.
View example_poor_docs.php
// if end date is in future
if ( $date_catchup_timestamp_end >= strtotime( 'now' ) ) {
// [...] do a lot of stuff
$program->end = $date_catchup_timestamp_end;
}
View true.md
01: !0                                // absolute best score  2  : vv
//~02: 0,a                            // absolute best score  3  : vv // old question
02: str_rot13                         // absolute best score  9  : vv
03: !0                                // absolute best score  2  : vv
04: 0                                 // absolute best score  1  : vv
05: 𡃁                                // absolute best score  1  : vv
06: $a=function()use(&$a){return$a;}  // absolute best score 22  : xx 32
07: (object)[1]                       // absolute best score 12  : vv
08:                                   // absolute best score 23  : xx --
@LC43
LC43 / wget_site.sh
Last active Dec 31, 2017
download a site using wget
View wget_site.sh
#!/bin/bash
function wget_site(){
## Remove protocol part of domain to add it to the allow list
# source : https://www.cyberciti.biz/faq/get-extract-domain-name-from-url-in-linux-unix-bash/
local url="$1"
local domain="$1"
domain="${domain#http://}"
domain="${domain#https://}"
domain="${domain#ftp://}"
domain="${domain#scp://}"
@LC43
LC43 / test-declare.sh
Created Nov 28, 2017
compare declare with assign
View test-declare.sh
# use declare
var1="aaa"; var2=var1; declare "$var2=bbb"; echo $var1; echo $var2
# returns:
# bbb
# var1
var1="aaa"; var2=var1; var2=bbb; echo $var1; echo $var2
# returns:
@LC43
LC43 / raisewindow.sh
Last active Nov 25, 2017
Raise window by name
View raisewindow.sh
#!/bin/bash
# name of app
if [ -z "$1" ]; then
echo "provide a name for the window to be raised"
exit;
fi
app_name="$1"
# get current desktop:
desktop_id=$(xprop -root | grep "^_NET_CURRENT_DESKTOP" | cut -f 3 -d ' ')
View exclude_prod
node_modules
*tgz*
*tar*
*zip*
.editorconfig
.jshintrc
CHANGELOG.md
README*
readme*
CONTRIBUTING.md
You can’t perform that action at this time.