Skip to content

Instantly share code, notes, and snippets.

@cmpscabral
cmpscabral / makeswap.sh
Created March 20, 2019 11:16
swap file memory
mkdir -p swap1
cd swap1
dd if=/dev/zero of=swapfile bs=1M count=2000
mkswap swapfile
swapon swapfile
chmod 600 swapfile
@cmpscabral
cmpscabral / cr2tojpeg
Last active July 6, 2022 18:43
convert RAW/CR2 to JPEG / resize
# convert raw to jpeg
for i in *.CR2; do sips -s format jpeg $i --out "${i%.*}.jpg"; done
# resize jpegs
for i in *.jpg; do sips -Z 2500 $i --out "./small/${i%.*}.jpg"; done
# convert to tiff with lzw compression
sips -s format tiff -s formatOptions lzw [file] --out [file]
# convert to jpeg lossless
@cmpscabral
cmpscabral / Country Currency Codes JSON
Created July 10, 2018 14:16 — forked from grosscorporation/Country Currency Codes JSON
currency symol, name, plural, and decimal digits for all major and minor currencies
[
{
"USD" : {
"symbol" : "$",
"name" : "US Dollar",
"symbol_native" : "$",
"decimal_digits" : 2,
"rounding" : 0,
"code" : "USD",
"name_plural" : "US dollars"
@cmpscabral
cmpscabral / instal.sh
Created April 13, 2018 15:18
install docker mysql
curl -sSL https://get.docker.com/ | sh
sudo docker run --name mysql-57-container -p 127.0.0.1:3310:3306 -e MYSQL_ROOT_PASSWORD=rootpassword -d mysql:5.7
mysql -u root -p --host=127.0.0.1 --port=3310
KEYBINDINGS
byobu keybindings can be user defined in /usr/share/byobu/keybindings/ (or within .screenrc if byobu-export was used). The common key bindings
are:
F2 - Create a new window
F3 - Move to previous window
F4 - Move to next window
@mixin valid-quantity($quantity) {
@if type-of($quantity) != 'number' {
@error 'The "quantity" parameter must be a number!';
}
@if not(unitless($quantity)) {
@error 'The "quantity" parameter must not have a unit!';
}
@if $quantity < 0 {
@error 'The "quantity" parameter must be at least 0!';
}
diff <(sort -u <(dig +nottlid +noall +answer @ns.myfirstserver.com example.com ANY) ) <(sort -u <(dig +nottlid +noall +answer @ns.mysecondserver.com example.com ANY) )
@cmpscabral
cmpscabral / browser-sync.sh
Created July 8, 2016 23:33
start browser sync proxy
browser-sync start --proxy "ds.dev" --files "dist/css/*.css" --host 192.168.200.2
<?php
/*
// recipients array example
$recipients = array(
array('address'=>
array(
'email' => 'email@tld.com',
'name'=>'Carlos Cabral'
)
@cmpscabral
cmpscabral / mysqltop.sh
Last active April 18, 2016 22:48
Poor Man's "Top" for MySQL
#
# http://naleid.com/blog/2009/06/18/poor-mans-top-for-mysql
#
watch -n 5 --differences "mysql -u root -p -e 'show processlist'"