Skip to content

Instantly share code, notes, and snippets.

View obrodinho's full-sized avatar

Rafael "Brodinho" Guimarães obrodinho

View GitHub Profile
@ryansully
ryansully / optimize.sh
Created February 1, 2012 23:56 — forked from realdeprez/optimize.sh
image optimization script (pngcrush & jpegtran)
#!/bin/sh
# script for optimizing images in a directory (recursive)
# pngcrush & jpegtran settings from:
# http://developer.yahoo.com/performance/rules.html#opt_images
# pngcrush
for png in `find $1 -iname "*.png"`; do
echo "crushing $png ..."
pngcrush -rem alla -reduce -brute "$png" temp.png
@jshaw
jshaw / byobuCommands
Last active May 12, 2024 20:03
Byobu Commands
Byobu Commands
==============
byobu Screen manager
Level 0 Commands (Quick Start)
------------------------------
<F2> Create a new window
@magnetikonline
magnetikonline / README.md
Last active December 22, 2021 17:13
Using Dnsmasq with Ubuntu 16.04LTS/14.04LTS/12.04LTS for virtual machine web application testing.

Using Dnsmasq with Ubuntu for VM web application testing

When running virtual machines under a Linux host system for testing web apps in various browsers (e.g. Internet Explorer), I found it rather tedious having to continually tweak the hosts file within each VM for the purpose of adding entries pointing back to the host machine's development web server address.

Instead the steps below will setup Dnsmasq on a Ubuntu 16.04LTS, 14.04LTS or 12.04LTS host machine for the purpose of serving both it's own DNS queries and that of virtual machine guests. Dnsmasq will parse the /etc/hosts file on your host machine where we will keep a single set of DNS entires to our test web application(s).

@mattiaslundberg
mattiaslundberg / arch-linux-install
Last active March 29, 2024 08:38
Minimal instructions for installing arch linux on an UEFI system with full system encryption using dm-crypt and luks
# Install ARCH Linux with encrypted file-system and UEFI
# The official installation guide (https://wiki.archlinux.org/index.php/Installation_Guide) contains a more verbose description.
# Download the archiso image from https://www.archlinux.org/
# Copy to a usb-drive
dd if=archlinux.img of=/dev/sdX bs=16M && sync # on linux
# Boot from the usb. If the usb fails to boot, make sure that secure boot is disabled in the BIOS configuration.
# Set swedish keymap
@cfxd
cfxd / .htaccess
Last active June 2, 2022 11:53
Deploy WordPress (Bedrock) with Capistrano to a Shared Host (Bluehost). See http://cfxdesign.com/deploy-wordpress-with-capistrano-on-bluehost/
RewriteEngine on
#change dev.example.com to your domain name
RewriteCond %{HTTP_HOST} ^(www.)?dev.example.com$
RewriteCond %{REQUEST_URI} !^/current/web/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /current/web/$1
#change dev.example.com to your domain name
RewriteCond %{HTTP_HOST} ^(www.)?dev.example.com$
RewriteRule ^(/)?$ current/web/index.php [L]
@paulopatto
paulopatto / README.md
Last active January 18, 2024 23:57
Converter taxa de cambio entre Moedas com Google SpreadSheet

Cotação de moedas com Planilhas do Google SpreadSheet

Hoje enquanto eu tentava criar minha calculadora de importação de produtos (com tributos, Taxa ilegal de processamento de encomendas internacionais e IOF). Com isso precisava de dados de conversão autmática de valores em Dollar americano para o Real brasileiro (USD -> BRL). A melhor solução que encontrei foi efetuar a pesquisa de cotação na url do google finance convert em https://www.google.com/finance/converter?a=1&from=USD&to=BRL. Bem tendo a url que nos retorna um documento HTML vamos pegar o dados com a função IMPORTXML

ImportXML(url; xpath query)

Importa dados de qualquer um dos vários tipos de dados estruturados, incluindo XML, HTML, CSV, TSV e XML de feeds RSS e Atom.

Com isso tenho o resultado como texto, ai tive de converter a planilha para formatação U.S.A para usar ponto como separador decimal e usar a formula de regex [0-9]*\.[0-9]+[0-9]+para extrair apenas o valor numérico. Minha formula completa

@fjmk
fjmk / README.md
Last active October 5, 2016 13:01
Howto use dnsdock in Ubuntu 14.04 trusty

Howto use dnsdock in Ubuntu 14.04 trusty

Using dnsdock resolves the problem of the changing IP's of containers. It is much easier to start a named container and use dns on the host to access the container simply by its name.

patch your /etc/ files so NetworkManager's dnsmasq to use the dnsdock nameserver.

sudo su -
cd
wget https://gist.githubusercontent.com/fjmk/a2bc6f9e01df9966c17b/raw/ad58b0823271e2f448df21f8a2226b719dec9353/etc-dnsdock.patch
cd /etc
@julz
julz / main.go
Created November 20, 2015 12:39
containersched minicontainer
package main
import (
"fmt"
"os"
"os/exec"
"syscall"
)
func main() {
@chris-jamieson
chris-jamieson / setup.md
Created April 19, 2016 15:43
Set up Franz for Ubuntu
  • Download Franz for your distribution from MeetFranz.com
  • change into the same directory as the downloaded file, then sudo tar -xf Franz-linux-x64-0.9.10.tgz -C /opt/franz
  • (optional) wget "https://cdn-images-1.medium.com/max/360/1*v86tTomtFZIdqzMNpvwIZw.png" -O franz-icon.png then sudo cp franz-icon.png /opt/franz
  • (optional) sudo touch /usr/share/applications/franz.desktop then sudo vim /usr/share/applications/franz.desktop

paste the following lines into the file, then save the file:

[Desktop Entry]
Name=Franz
Comment=
#!/bin/bash
url="https://gist.githubusercontent.com/RichardBronosky/2d04c7c2e9a5bea67cd9760a35415a3f/raw/install_mongo.sh"
script="/tmp/userdata.sh"
echo "Running userdata script as $(whoami) from $(pwd)"
# Log commands to stdout and vicariously /var/log/cloud-init-output.log
set -o xtrace
# Exit on error