Skip to content

Instantly share code, notes, and snippets.

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

Rodrigo Ayala RodrigoAyala

🏠
Working from home
View GitHub Profile
@RodrigoAyala
RodrigoAyala / nodejs_installer.sh
Created March 24, 2013 01:49
Bash script to install NodeJS on the Raspberry Pi
#!/bin/bash
echo -e "nodejs_installer.sh - \033[37mNode\033[32m\033[32mJS \033[0minstaller for \033[35mRaspberry Pi\033[0m"
echo -e "========================================================\n"
if [ "$(uname -m)" != "armv6l" ]; then
echo -e "\033[31mError: \033[0marmv6l architecture not found. (Are you sure that you are running the script on a Raspberry Pi?)\033[0m";
exit 1;
else
echo -e "\033[35mRaspberry Pi \033[32mfound! Proceeding...\033[0m"
@RodrigoAyala
RodrigoAyala / tree.txt
Created July 11, 2013 16:12
Debug info for tv.js issue
**Tree diagram of files and folders:**
```
.
├── LICENSE
├── Makefile
├── README.md
├── bin
│   └── run.js
├── config.js
@RodrigoAyala
RodrigoAyala / AppDelegate.cpp
Created October 28, 2013 18:32
Boilerplate code AppDelegate.cpp for Cocos2d-x games
bool AppDelegate::applicationDidFinishLaunching() {
CCSize designSize = CCSizeMake( 480,320);
CCSize resourceSize = CCSizeMake(480,320);
CCSize screenSize = CCEGLView::sharedOpenGLView()->getFrameSize();
std::vector<std::string> searchPaths;
std::vector<std::string> resDirOrders;
TargetPlatform platform = CCApplication::sharedApplication()->getTargetPlatform();
if (platform == kTargetIphone || platform == kTargetIpad)
@RodrigoAyala
RodrigoAyala / iptables.sh
Created June 9, 2014 14:27
Iptables script which blocks all connections, except incoming SSH, HTTP and HTTPS, and outgoing DNS, HTTP and HTTPS
#!/bin/sh
iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP
iptables -A INPUT -i eth0 -p tcp --dport 22 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -o eth0 -p tcp --sport 22 -m state --state ESTABLISHED -j ACCEPT
iptables -A INPUT -i eth0 -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT
@RodrigoAyala
RodrigoAyala / servel.sh
Last active October 20, 2016 14:58
Descarga automática de los PDF pertenecientes al Padrón Electoral del Servel
curl -s http://web.servel.cl/archivos.xml | grep -ohE 'A\d{7}.pdf' | while read x; do curl -o $x http://web.servel.cl/padron/$x; done