Skip to content

Instantly share code, notes, and snippets.

View mindware's full-sized avatar

Andrés mindware

View GitHub Profile
#!/usr/bin/env bash
set -e
target_osx=$(sw_vers -productVersion)
project_dir=$HOME/aseprite
skia_dir=$HOME/deps/skia
arch="$(uname -m)"
bundle_trial_url=https://www.aseprite.org/downloads/trial/Aseprite-v1.2.40-trial-macOS.dmg
@mindware
mindware / .bashrc
Last active April 13, 2020 02:22
auto ls and open command for ubuntu
# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
export PATH="$PATH:$HOME/.rvm/bin"
source ~/.rvm/scripts/rvm
alias rs='rake start'
alias open='xdg-open'
#function cd() { builtin cd "$@" && ls -G; }
export ENDCOLOR="\033[00m";
autocmd Filetype html setlocal ts=2 sw=2 expandtab
autocmd Filetype ruby setlocal ts=2 sw=2 expandtab
autocmd Filetype javascript setlocal ts=4 sw=4 sts=0 noexpandtab
@mindware
mindware / collatz.rb
Created August 9, 2016 03:39
Collatz Conjecture
# Collatz Conjecture
# https://www.youtube.com/watch?v=5mFpVDpKX70
print "Give me a number: "
number = gets.chomp.to_i
if number == 0
puts "Try again with a non-zero integer."
exit
end
count = 0
while number != 1
@mindware
mindware / batcharge.py
Created June 3, 2016 19:54
Battery monitoring for Mac - Python
#!/usr/bin/env python
# coding=UTF-8
# -*- coding: UTF-8 -*-
# source:
# http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/#my-right-prompt-battery-capacity
import math, subprocess
p = subprocess.Popen(["ioreg", "-rc", "AppleSmartBattery"], stdout=subprocess.PIPE)
output = p.communicate()[0]
@mindware
mindware / gist:842dc789895a66cbb16d
Last active August 29, 2015 14:24
Brute force your way through piles of hex to search keys (strings, digits)
######################################################################
# A simple script written to find keywords and digits inside #
# blobs of hex data, used for some quick and dirty basic protocol #
# reverse-engineering. #
# #
# You can find a given string or digit inside a hex #
# in a blob of text. #
# Usage: ruby brute.rb <keys_to_find> <paste your hex> #
# #
# Multiple keys: #
@mindware
mindware / batcharge.py
Last active August 29, 2015 14:21
Python script to check the battery for zsh theme
#!/usr/bin/env python
# coding=UTF-8
# -*- coding: UTF-8 -*-
# saved to ~/bin/batcharge.py and from
# http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/#my-right-prompt-battery-capacity
import math, subprocess
p = subprocess.Popen(["ioreg", "-rc", "AppleSmartBattery"], stdout=subprocess.PIPE)
output = p.communicate()[0]
@mindware
mindware / andres.zsh-theme
Created May 26, 2015 16:45
ZSH Theme that checks battery and online connectivity
# vim:ft=zsh ts=2 sw=2 sts=2
#
# Based on agnoster's Theme - https://gist.github.com/3712874
# A Powerline-inspired theme for ZSH
#
# # README
#
# In order for this theme to render correctly, you will need a
# [Powerline-patched font](https://gist.github.com/1595572).
#
@mindware
mindware / online-check.sh
Created May 26, 2015 16:44
Cronjob to check if we're online
#!/bin/zsh
# Saved in ~/online-check.sh and in a cron job as:
# * * * * * ~/online-check.sh
local offline=`dig 8.8.8.8 +time=1 +short google.com A | grep -c "no servers could be reached"`
if [[ "$offline" == "0" ]]; then
rm ~/.offline
else
touch ~/.offline
@mindware
mindware / gist:459b34f933d1914e2020
Created March 26, 2015 05:46
Atomically delete all resque keys from redis (requires you have enough memory to handle all keys)
EVAL "return redis.call('DEL', unpack(redis.call('KEYS', ARGV[1] .. '*')))" 0 resque: