Skip to content

Instantly share code, notes, and snippets.

View rendon's full-sized avatar
🧑‍🔬
Trying new things out.

Rafael Rendón rendon

🧑‍🔬
Trying new things out.
View GitHub Profile
@rendon
rendon / TimeTravellingSalesman.cpp
Last active November 18, 2015 06:06
TimeTravellingSalesman.cpp
#include <iostream>
#include <algorithm>
#include <sstream>
#include <vector>
#include <string>
#include <fstream>
#include <set>
#include <numeric>
#include <regex>
@rendon
rendon / gettwitterfollowers.rb
Created September 18, 2015 23:42
Get follower IDs of user.
require 'twitter'
client = Twitter::REST::Client.new do |config|
config.consumer_key = "..."
config.consumer_secret = "..."
config.access_token = "..."
config.access_token_secret = "..."
end
user = 123
cursor = client.follower_ids(user, count: 5000)

Create instance

Using the ec2 tools:

ec2-run-instances ami-xxxxxxxx -t t2.micro -k mykeypair -g sg-xxxxxxx

Using aws:

aws ec2 run-instances --image-id ami-xxxxxx --count 1 --instance-type t2.micro --key-name mykeypair --security-groups mysecuritygroup

@rendon
rendon / brightness_control_i3wm.sh
Last active November 6, 2015 05:15
Some bash functions to manage screen brightness when your fn+<key> does not work.
function max() {
if [ $1 -gt $2 ]
then
echo $1
else
echo $2
fi
}
function min() {
@rendon
rendon / invasion_zombiev1.cpp
Created November 12, 2015 16:44
Invasion zombie v1
const int MAX = 1000;
//endregion
long long X, Y, N;
long long ta(long long length)
{
return length * (length + 1) / 2;
}
// Upper right
@rendon
rendon / invasion_zombie_check.cpp
Created November 12, 2015 16:48
Invasion zombie check
bool check(int64 d, int64 c) {
return f(d) >= c;
}
@rendon
rendon / invasion_zombiev2.cpp
Created November 12, 2015 16:56
Invasion zombie v2
#include <bits/stdc++.h>
using namespace std;
typedef long long int64;
inline int64 f(int64 x) {
return x * x + (x + 1) * (x + 1);
}
inline int64 g(int64 x) {
return x * (x + 1) / 2;
@rendon
rendon / datamaps_country_codes.txt
Created November 12, 2015 19:17
Datamaps country codes
AFG: Afghanistan
AGO: Angola
ALB: Albania
ARE: United Arab Emirates
ARG: Argentina
ARM: Armenia
ATA: Antarctica
ATF: French Southern and Antarctic Lands
AUS: Australia
AUT: Austria
@rendon
rendon / continents_with_countries.json
Created November 18, 2015 19:50
Continents with countries, the list is not complete.
{
"africa": {
"name": "Africa",
"names": [
"Афрыка",
"Àfrica",
"Afrika",
"Afrika",
"Afrika",
"Αφρική",
@rendon
rendon / fb_bot.js
Created January 6, 2016 20:46
FB bot
// ========================================
// ! Casper
// ! Common issues: Unsafe Javascript attempt to access frame with URL
// ! Issues: http://goo.gl/u1murB
// ! Version : 1.0
// ========================================
var fs = require('fs');
var utils = require('./src/utils');
var system = require('system');
var casper = require('casper').create();