Skip to content

Instantly share code, notes, and snippets.

View ricrogz's full-sized avatar

Ricardo Rodriguez ricrogz

View GitHub Profile
@ricrogz
ricrogz / .screenrc
Last active August 29, 2015 14:25
Nice screen bottomline
#change the hardstatus settings to give an window list at the bottom of the
#screen, with the time and date and with the current window highlighted
startup_message off
hardstatus alwayslastline
#hardstatus string '%{= mK}%-Lw%{= KW}%50>%n%f* %t%{= mK}%+Lw%< %{= kG}%-=%D %d %M %Y %c:%s%{-}'
hardstatus string '%{gk}[ %{G}%H %{g}][%= %{wk}%?%-Lw%?%{=b kR}(%{W}%n*%f %t%?(%u)%?%{=b kR})%{= kw}%?%+Lw%?%?%= %{g}][%{Y}%l%{g}]%{=b C}[ %m/%d %c ]%{W}'
defscrollback 5000
autodetach on
idle 600 eval "screen cmatrix -f -o -u 10" "idle 0"
@ricrogz
ricrogz / gist:72bc3fb63bfbd528aa17
Created September 22, 2015 15:40
Twitter from console (made in Ruby)
https://github.com/sferik/t
Requires Ruby 1.9.3 + rubygems
@ricrogz
ricrogz / gist:2bc12679b7e881a457aaae216ef6d66e
Created April 19, 2016 07:50
Find the mean, min and max values in a column using awk
$ awk '{if(min==""){min=max=$1}; if($1>max) {max=$1}; if($1< min) {min=$1}; total+=$1; count+=1} END {print total/count, min, max}' FILE.DAT
@ricrogz
ricrogz / history_on_input_method.py
Last active July 25, 2016 15:37
Python: history for input() method
import readline
"""
Just importing the 'readline' ('or 'gnureadline', as it has been renamed) package will do!
To add text completion: see here: https://pymotw.com/2/readline/
"""
While True:
@ricrogz
ricrogz / console_colors.py
Created July 24, 2016 20:47
Python: colors on console output
import colorama
# Optional?? I did not put it in my code, and outputs colors just fine.
# colorama.init()
print(colorama.Fore.RED + 'some red text')
print(colorama.Back.GREEN + 'and with a green background')
print(colorama.Style.DIM + 'and in dim text')
print(colorama.Style.RESET_ALL)
print('back to normal now')
@ricrogz
ricrogz / completion.py
Last active July 26, 2016 07:09
python: recursive command line completion
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
"""
USE UNDER YOUR OWN RESPONSIBILITY!!
IMPORTANT: options with sub-levels MUST end with spaces!!!
"""
@ricrogz
ricrogz / my-cartpole-rev1.py
Created August 10, 2016 12:53
OpenAI -- CartPole-v0
#!/usr/bin/env python2
"""
I am new both to OpenAI and AI itself.
I have to (shamelessly) admit that I have just taken the coded uploaded by 'shanest'
from his write up (https://gym.openai.com/evaluations/eval_RE77KlTNTvCGzTgtm0Qqg),
studied it, and lightly tweaked it with my own ideas.
@ricrogz
ricrogz / gist:bef9042e1e4928f8b9cda720cac72b53
Created December 23, 2016 15:45
Google Custom Search JSON API example
# coding: utf-8
api = "api_key"
search_id = "search_id_code"
query = "query words"
url="https://www.googleapis.com/customsearch/v1?key={}&cx={}&q={{}}&fields=items(link)&dateRestrict=y2&start=11".format(api, search_id);
a = requests.get(url.format(query)); print(a.status_code); a.json()
### Keybase proof
I hereby claim:
* I am ricrogz on github.
* I am invik (https://keybase.io/invik) on keybase.
* I have a public key whose fingerprint is 5D76 3A33 A52C 586F 9537 BA40 D076 E68B D60E 8400
To claim this, I am signing this object:
convert -density 300 proyectos.pdf -compress LZW -resample 150 -colors 31 test.pdf