Skip to content

Instantly share code, notes, and snippets.

@lopespm
lopespm / gist:7411599
Last active December 28, 2015 00:09 — forked from gcatlin/gist:1847248
# Original Gist by gcatlin/gist:1847248
#
brew update
brew versions FORMULA
cd `brew --prefix`
git checkout HASH Library/Formula/FORMULA.rb # use output of "brew versions"
brew unlink FORMULA
brew install FORMULA
git checkout -- Library/Formula/FORMULA.rb # reset formula
@lopespm
lopespm / .bash_profile
Last active June 5, 2020 02:37 — forked from natelandau/.bash_profile
Show git branch
# ---------------------------------------------------------------------------
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
# 6. Networking
# 7. System Operations & Information
@lopespm
lopespm / .gitignore
Created January 31, 2015 22:23
Unity 3D .gitignore
*.DS_Store
[Ll]ibrary/
[Tt]emp/
[Oo]bj/
[Bb]uild/
#Un-ignore these specific files
!/Library/*.asset
!/Library/AssetImportState
#!/bin/bash
# This script resizes all the images it finds in a folder (and its subfolders) and resizes them
# The resized image is placed in the /resized folder which will reside in the same directory as the image
#
# Usage: > ./batch_resize.sh
initial_folder="/your/images/folder" # You can use "." to target the folder in which you are running the script for example
resized_folder_name="resized"
all_images=$(find -E $initial_folder -iregex ".*\.(jpg|gif|png|jpeg)")
@lopespm
lopespm / print_where_path_is_defined.sh
Created February 16, 2016 01:43
Print out of where your OSX Terminal bash $PATH is being defined
#!/bin/bash
# Simple script to print out where your PATH variable is getting defined on for your OSX bash Terminal
#
echo -e "------------------------------------------------"
echo -e "------- ~/.bash_profile -------"
echo -e "------------------------------------------------"
cat ~/.bash_profile | grep PATH=
echo -e ""
@lopespm
lopespm / bootlocal.sh
Last active June 20, 2016 16:11
Docker - mount other folder other than /Users in osx
# from https://github.com/docker/machine/issues/1826#issuecomment-143863060
#if using boot2docker
#create file bootlocal.sh inside /var/lib/boot2docker; so it will persist and get executing when boot2docker images runs
##if target folder not present; create one
mkdir [target folder]
##mount the hostfolder; it should be shared with virtualbox already
##[hostfolder] is the folder name you gave when sharing the folder, not the path
sudo mount -t vboxsf -o uid=1000,gid=1000 [hostfolder] [target folder]
@lopespm
lopespm / libre_office_tableau20_palette.soc
Last active August 27, 2016 17:21
Libre Office Tableau 20 color palette, which you can use in Libre Draw for example - colors extracted from http://tableaufriction.blogspot.pt/2012/11/finally-you-can-use-tableau-data-colors.html
<?xml version="1.0" encoding="UTF-8"?>
<ooo:color-table xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ooo="http://openoffice.org/2004/office">
<draw:color draw:name="tb01" draw:color="#1f77b4"/>
<draw:color draw:name="tb02" draw:color="#aec7e8"/>
<draw:color draw:name="tb03" draw:color="#ff7f0e"/>
<draw:color draw:name="tb04" draw:color="#ffbb78"/>
<draw:color draw:name="tb05" draw:color="#2ca02c"/>
<draw:color draw:name="tb06" draw:color="#98df8a"/>
<draw:color draw:name="tb07" draw:color="#d62728"/>
<draw:color draw:name="tb08" draw:color="#ff9896"/>
@lopespm
lopespm / do_action_for_every_device.sh
Last active December 28, 2016 00:29
Do ADB action for every connected android device
#!/bin/bash
# In this case, it is installing an apk for every connected device, but could be any other ADB action
adb devices | awk 'FNR>1 {print $1}'| while read line ; do adb -s $line install the-app.apk ; done
@lopespm
lopespm / EnumerableMidRange.cs
Last active May 30, 2017 21:32
MidRange Enumerable Extension (C# LINQ)
using System.Collections.Generic;
using System.Linq;
static class EnumerableExtensions
{
/// <summary>
/// Calculate the enumerable's mid-range https://en.wikipedia.org/wiki/Mid-range
/// </summary>
public static float MidRange(this IEnumerable<float> source)
{
@lopespm
lopespm / useful_android_adb_commands.txt
Created December 1, 2017 17:45
Useful android ADB commands
# Show Tasks
adb shell dumpsys activity activities | sed -En -e '/Stack #/p' -e '/Running activities/,/Run #0/p'