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 / vim_7.4_compilation
Last active August 29, 2015 13:56
Instructions to compile Vim 7.4 in Debian with GUI support.
#!/bin/bash
./configure --with-x --with-features=huge --enable-rubyinterp \
--enable-pythoninterp --with-python-config-dir=/usr/lib/python2.7/config \
--enable-gui=gtk2 --enable-cscope --prefix=/usr --enable-gtk2-check
make VIMRUNTIMEDIR=/usr/share/vim/vim74
sudo make install
#Set vim as your default editor with update-alternatives.
@rendon
rendon / str.sh
Created May 23, 2014 02:02
Single Test Runner
#!/bin/bash
if [ -z $1 ]
then
echo "USAGE: $0 <test file without extension>";
echo "EXAMPLE: $0 TestQuickSort";
exit 1;
fi
cat > .build <<EOF
@rendon
rendon / prefixes_and_suffixes.cpp
Created June 4, 2014 03:12
Codeforces #246 Div 2 D: Prefixes and Suffixes
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
using namespace std;
const int MAX = 100005;
char S[MAX];
int Z[MAX];
@rendon
rendon / substring_frequency.cpp
Created June 4, 2014 03:24
Light OJ: 1255 - Substring Frequency
//region Template
#include <bits/stdc++.h>
//#define ONLINE_JUDGE
using namespace std;
//ios_base::sync_with_stdio(false);
inline int log(const char* format, ...)
{
#ifndef ONLINE_JUDGE
va_list args;
va_start(args, format);
@rendon
rendon / tachibana_kanades_tofu.cpp
Created June 4, 2014 04:48
Codeforces #248 Div 2 E. Tachibana Kanade's Tofu
//region Template
#include <bits/stdc++.h>
//#define ONLINE_JUDGE
using namespace std;
//ios_base::sync_with_stdio(false);
inline int log(const char* format, ...)
{
#ifndef ONLINE_JUDGE
va_list args;
va_start(args, format);
@rendon
rendon / gist:7f2aaab4c395e2cb6e6b
Created August 12, 2014 02:48
Omegaup service.log
2014-07-31 18:55:07,561 [main] INFO omegaup.Logging - Logger loaded for /var/log/omegaup/service.log
2014-07-31 18:55:07,605 [main] INFO org.eclipse.jetty.util.log - Logging initialized @758ms
2014-07-31 18:55:07,690 [main] INFO org.eclipse.jetty.server.Server - jetty-9.1.z-SNAPSHOT
2014-07-31 18:55:07,741 [main] INFO o.e.jetty.server.ServerConnector - Started ServerConnector@4f106738{HTTP/1.1}{0.0.0.0:39613}
2014-07-31 18:55:07,741 [main] INFO org.eclipse.jetty.server.Server - Started @900ms
2014-07-31 18:55:07,742 [main] INFO omegaup.broadcaster.Broadcaster - Registering port 39613
2014-07-31 18:55:07,742 [main] INFO omegaup.broadcaster.Broadcaster - Broadcaster started
2014-07-31 18:55:10,444 [main] INFO omegaup.grader.RoutingDescription - Parsing routing table:
2014-07-31 18:55:10,536 [main] INFO omegaup.grader.RoutingDescription - Routing rule parsed: List()
2014-07-31 18:55:10,566 [main] INFO omegaup.grader.RoutingDescription - Parsing routing table:
@rendon
rendon / glock_instructions.md
Last active August 29, 2015 14:25
How to use Glock

How to use Glock in Hypertask

  1. Set $GOPATH to the Hypertask directory.
  2. Install with glock install hypertask/api
  3. Synchronize with glock sync hypertask/api

Easy...!

@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() {