Skip to content

Instantly share code, notes, and snippets.

View bmaca's full-sized avatar
💭
Sipping coffee ☕️

BMac bmaca

💭
Sipping coffee ☕️
View GitHub Profile
@bmaca
bmaca / update_repos.sh
Created March 12, 2020 16:34
Update all git repositories from the given branch
!/bin/bash
PROJECT_DIR=$HOME/{projects_path}
GIT_BRANCH=$1
function pull_repos() {
echo -e "\n\033[1mPulling in latest changes for all repositories...\033[0m\n"
# Find all git repositories and update it to the desired branch latest version
for repo in $(find $PROJECT_DIR -name ".git" | rev | cut -c5- | rev); do
@bmaca
bmaca / pre-commit.sh
Last active October 4, 2017 05:56
The goal of this pre-commit git hook is to provide an automated way to update "my_object_date" value in any/dir/I/want changes are made to them.
#!/bin/bash
# get todays curent day timestamp with year/month/day format
DATE="$(date +%Y-%m-%d)"
# get staged files for MYDIR1 directory
MDIR1="$(git diff --staged --name-only any/path/you/like)"
# get staged files for MYDIR2 directory
MYDIR2="$(git diff --staged --name-only any/path/you/like)"
@bmaca
bmaca / adb-devices.sh
Created October 8, 2016 15:04
Run a list of devices
adb devices | while read line
do
if [ ! "$line" = "" ] && [ `echo $line | awk '{print $2}'` = "device" ]
then
device=`echo $line | awk '{print $1}'`
echo "$device $@ ..."
adb -s $device $@
fi
done
@bmaca
bmaca / instructionsLXD.md
Last active July 1, 2016 06:32
Install lxd containers on Ubuntu 14.04

Follow these steps to install lxd containers on Ubuntu 14.04. Please note this worked for me on my ubuntu14.04 box running on AWS ec2 instance.

To install lxd containers on Ubuntu it requires that you install lxd using backports. If you dont know what backports are you can read more about them here https://help.ubuntu.com/community/UbuntuBackports

  1. Active backports sudo vim /etc/apt/sources.list Uncomment lines 45 and 46, save and quit.
  2. sudo apt-get update && sudo apt-get -t trusty-backports install lxd -y
  3. sudo lxd init - This will prompt some questions about some basic configuration stuff. Follow the steps.
@bmaca
bmaca / a.rb
Created December 10, 2015 08:49
FILE=/path/to/access.log;
for ip in `cat $FILE | awk '{print $1}' |sort |uniq`;
do { COUNT=`grep ^$ip $FILE |wc -l`;
if [[ "$COUNT" -gt "500" ]]; then echo "$COUNT: $ip";
fi }; done
@bmaca
bmaca / delete_spam.py
Last active November 25, 2015 14:21
Delete Gmail Spam
import gmail
import sys
GMAIL_USERNAME = ENV['GMAIL_USERNAME']
GMAIL_PASSWORD = ENV['GMAIL_PASSWORD']
ma_mail = gmail.login(GMAIL_USERNAME, GMAIL_PASSWORD)
if not ma_mail.logged_in:
print "MISSION FAILED. ABORT ABORT ABORT "
@bmaca
bmaca / logs.txt
Created September 8, 2015 04:12
logs for android falcon
ON WIFI
I/ActivityManager( 817): START u0 {cmp=com.jv.materialfalcon/.activity.SearchActivity (has extras)} from pid 26473
V/JOAQUIM (26473): loadFromNetwork elitefts
E/RecyclerView(26473): No adapter attached; skipping layout
E/RecyclerView(26473): No adapter attached; skipping layout
E/RecyclerView(26473): No adapter attached; skipping layout
ON CELLULAR NETWORK
I/ActivityManager( 817): START u0 {cmp=com.jv.materialfalcon/.activity.SearchActivity (has extras)} from pid 26473
E/RecyclerView(26473): No adapter attached; skipping layout
@bmaca
bmaca / reminder.py
Created February 23, 2015 03:09
A python program to remind you to take a break every hour on your 8 hour work shift ;)
import time
import webbrowser
total_breaks = 8
break_count = 0
while (break_count < total_breaks):
time.sleep(3600)
webbrowser.open("https://31.media.tumblr.com/288d6e631cd930de65547ef5044fefb8/tumblr_mlksb86paT1qbuvyto1_500.gif")
break_count = break_count + 1
@bmaca
bmaca / remove.txt
Created February 20, 2015 01:09
remove superfish certifucate from lenovo
Uninstall Superfish via the Control Panel. Look for "Superfish Inc VisualDiscovery"
Then it's time to uninstall the certificate from Windows. First open the Windows certificate manager. You can search for "certmgr.msc," right-click it and choose the option "Run as administrator"
Click "Trusted Root Certificate Authorities" and select "Certificates"
Scroll to the "Superfish, Inc." certificate
Right-click it and select "delete"
@bmaca
bmaca / himalayas.java
Created February 17, 2015 02:01
the himalaya climb
class himalayas {
public static void main(String[] args) {
int x = 0;
while (x < 4 ) {
System.out.println("Bill");
if (x < 1) {
System.out.println(" ");
}