Skip to content

Instantly share code, notes, and snippets.

@rodrigobdz
rodrigobdz / png-to-svg.sh
Last active September 19, 2019 04:28
Convert PNG to SVG in macOS
#!/usr/bin/env bash
qlmanage -t -s 1000 -o . $1
@rodrigobdz
rodrigobdz / .bashrc
Created June 19, 2019 04:10
Custom Bash prompt
#...
PS1='${debian_chroot:+($debian_chroot)}\[\033[03;36m\]\u@\h\[\033[00m\]:\[\033[01;33m\]\w\[\033[00m\]\$ '
#...
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// choose either `'stable'` for receiving highly polished,
// or `'canary'` for less polished but more frequent updates
updateChannel: 'stable',
@rodrigobdz
rodrigobdz / config.fish
Created April 16, 2019 07:35
Avoid blue triangle from iTerm Shell Integration in command prompt
# iTerm Shell Integration loading
test -e {$HOME}/.iterm2_shell_integration.fish ; and source {$HOME}/.iterm2_shell_integration.fish
# Override to avoid blue mark at the beginning of each command prompt
function iterm2_prompt_mark
end
/**
* Update values only for existing keys
* @param {Object} outdated Object with old values
* @param {Object} updated Object with updated values, it may have unnecessary keys.
*/
const updateExistingProperties = (outdated, updated) => {
var result = {...outdated}
for (let k of Object.keys(updated)) {
// Ignore unnecessary keys
if (!(k in result)) {
@rodrigobdz
rodrigobdz / up-raspbian.sh
Last active December 7, 2018 08:40
UPgrade your Raspbian programs via CLI 🎈
#!/bin/bash
set -o errexit
set -o pipefail
set -o nounset
set -o errtrace
{
# APT
apt-get update && apt-get upgrade --yes --autoremove
@rodrigobdz
rodrigobdz / fix-wordpress-permissions.sh
Last active March 21, 2019 10:49 — forked from Adirael/fix-wordpress-permissions.sh
Fix wordpress file permissions
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org>
#
WP_OWNER=www-data # <-- wordpress owner
WP_GROUP=www-data # <-- wordpress group
WP_ROOT=/var/www/html # <-- wordpress root directory
@rodrigobdz
rodrigobdz / mkfile-with-size.sh
Created February 20, 2018 08:07
Create empty file with a certain file size
#!/bin/bash
# Create an empty file with size 10 MB
mkfile -n 10m foo
# Create an empty file with size 1 GB
mkfile -n 1g foo
@rodrigobdz
rodrigobdz / watch-and-reload.sh
Created January 27, 2018 14:52
Edit .svg files in macOS and livereload
#!/bin/bash
FILE_TO_WATCH=<PATH TO SVG>
filewatcher $FILE_TO_WATCH 'reload' "osascript -e 'tell application \"Safari\" to set URL of current tab of front window to \"file://$FILE_TO_WATCH\"'"
@rodrigobdz
rodrigobdz / testMissingTranslations.js
Created January 21, 2018 16:22
Test for missing translations in i18n
import I18n from 'i18n'
const deepKeys = require('deep-keys');
const NO_DIFF = null
Object.defineProperty(Object.prototype, 'translations', {
get: function() {
let locale = Object.keys(this)[0]
return [ locale, this[locale] ]