Skip to content

Instantly share code, notes, and snippets.

View DavidToca's full-sized avatar
🕶️
testing

David Toca DavidToca

🕶️
testing
View GitHub Profile
@DavidToca
DavidToca / git.plugin.zsh
Created July 10, 2012 22:17
oh-my-zsh git alias
# Aliases
alias g='git'
compdef g=git
alias gst='git status'
compdef _git gst=git-status
alias gl='git pull'
compdef _git gl=git-pull
alias gup='git fetch && git rebase'
compdef _git gup=git-fetch
alias gp='git push'
{
"result":
" #
##
###
####"
}
{
"result":
" #
##
###
####"
}
@DavidToca
DavidToca / aoc.py
Last active December 2, 2020 21:29
AoC 2020 day 2-1
response = 0
for case in input_data:
numbers, letter, work = case.split(' ')
min_number,max_number = numbers.split('-')
letter = letter[0]
min_number = int(min_number)
max_number = int(max_number)
letter_count = work.count(letter)
if letter_count >= min_number and letter_count <= max_number:
response+=1
@DavidToca
DavidToca / aoc.py
Created December 2, 2020 21:27
AoC 2020 2-2
response = 0
for case in input_data:
numbers, letter, work = case.split(' ')
min_number,max_number = numbers.split('-')
letter = letter[0]
min_number = int(min_number) - 1
max_number = int(max_number) - 1
if bool(work[min_number] == letter) ^ bool(work[max_number] == letter):
response+=1
@DavidToca
DavidToca / Install PIL on linux
Last active May 7, 2018 17:03
Install PIL on linux
sudo apt-get update ;
sudo apt-get install libjpeg-turbo8-dev libjpeg8-dev ;
sudo apt-get install libjpeg-dev libfreetype6 libfreetype6-dev zlib1g-dev zlib1g-dev libfreetype6-dev liblcms1-dev libjpeg62-dev;
sudo apt-get build-dep python-imaging
#PIL cant find the files he needs, so we need to make symlinks to the files he looks for
sudo ln -s /usr/lib/`uname -i`-linux-gnu/libfreetype.so /usr/lib/ ;
sudo ln -s /usr/lib/`uname -i`-linux-gnu/libjpeg.so /usr/lib/ ;
sudo ln -s /usr/lib/`uname -i`-linux-gnu/libz.so /usr/lib/;
@DavidToca
DavidToca / install.sh
Last active March 25, 2018 09:57
setup manjaro
#!/bin/bash
# update package index
echo "----------------------UPDATING PACKAGES----------------"
sudo pacman -Syu --noconfirm
echo "----------------------INSTALLING GOOGLE CHROME--------------------"
yaourt google-chrome -S --noconfirm
echo "----------------------INSTALLING TERMINATOR ---------"
yaourt terminator -S --noconfirm
@DavidToca
DavidToca / gist:8391709
Created January 12, 2014 22:46
install nginx
sudo -s
nginx=stable # use nginx=development for latest development version
add-apt-repository ppa:nginx/$nginx
apt-get update
apt-get install nginx
@DavidToca
DavidToca / install_python.sh
Last active January 3, 2016 01:49
install python development tools on ubuntu
sudo apt-get install -y python-pip python-dev build-essential
sudo pip install --upgrade pip
sudo pip install --upgrade virtualenv
pip install virtualenvwrapper
@DavidToca
DavidToca / install.sh
Created January 6, 2014 03:20
new ubuntu machine
sudo apt-get install git-core;
sudo apt-get install zsh
curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:cassou/emacs
sudo apt-get update
sudo apt-get install emacs24