Skip to content

Instantly share code, notes, and snippets.

View gtfunes's full-sized avatar
🏠
Working from home

Gastón Funes gtfunes

🏠
Working from home
View GitHub Profile
@gtfunes
gtfunes / start-avd.sh
Created September 1, 2021 02:25
Start Android AVD from CLI
#!/bin/bash
# - Selects an AVD emulator and boots it up -
HAS_DEVICE=$(adb get-state 2>/dev/null)
if [ ! -z "$HAS_DEVICE" ]; then
echo "A device is connected, nothing to do here..."
exit
fi
@gtfunes
gtfunes / clean-install.sh
Created March 9, 2020 16:21
Bash script to remove all caches related to a react-native project and reinstall all dependencies
#!/bin/bash
# - Clears app caches, run from project root -
echo -e "Removing caches...\n"
rm -rf node_modules
rm -rf ios/build
rm -rf ios/Pods
rm -rf ~/Library/Developer/Xcode/DerivedData
rm -rf $TMPDIR/react-* && rm -rf $TMPDIR/metro-* && rm -rf $TMPDIR/haste-*
@gtfunes
gtfunes / dock-space.sh
Created August 10, 2019 21:40
Creates an empty space in the macOS dock
#!/bin/bash
# - Creates an empty space in the dock -
defaults write com.apple.dock persistent-apps -array-add '{"tile-type"="spacer-tile";}'
killall Dock
@gtfunes
gtfunes / apt-nice-update.sh
Created May 14, 2019 13:59
A bash script for low-end machines (mostly RPis) that sometimes crash when updating too many packages at the same time
#!/bin/bash
# - Runs apt-get upgrade for each individual package to avoid killing low-end machines -
DATA=$(apt-get upgrade -s -y -q | grep "Inst " | cut -d ' ' -f 2)
PACKAGES=(${DATA// / })
Z=0
for package in "${PACKAGES[@]}";
do
@gtfunes
gtfunes / wifi-switch.sh
Created March 14, 2019 18:26
Bash script to switch between wifi networks when they lose connection (works on macOS & Linux)
#!/bin/bash
# - WiFi switching script -
# Reads from wifis.txt file that has one network per line name=password
echo "Loading known networks list..."
MAX_NETWORKS=0
while IFS='=' read -r var value || [[ -n "$line" ]]; do
WIFI_NETWORK_NAMES[MAX_NETWORKS]="${var}"
@gtfunes
gtfunes / NSObject+performBlock.h
Created March 7, 2019 14:14
An NSObject category (Obj-C) to perform code blocks in particular threads and with different priorities
//
// NSObject+performBlock.h
//
#import <Foundation/Foundation.h>
/**
An NSObject category to perform code blocks in particular threads and with different priorities
*/
@interface NSObject (PerformBlock)
@gtfunes
gtfunes / ImageUtils.java
Last active March 6, 2019 23:23
Java class to compress, resize & correctly rotate (using EXIF data) images from disk
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.support.media.ExifInterface;
import android.util.Log;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@gtfunes
gtfunes / keybase.md
Last active September 14, 2019 17:02

Keybase proof

I hereby claim:

  • I am gtfunes on github.
  • I am gtfunes (https://keybase.io/gtfunes) on keybase.
  • I have a public key ASBPo51cFQG7MMMIoi4j6uVf5OLG6eyOwpLjP1Wjhvsaugo

To claim this, I am signing this object: