Skip to content

Instantly share code, notes, and snippets.

Pedro Henriques dos Santos Teixeira pedroteixeira

Block or report user

Report or block pedroteixeira

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
echo "info" | redis-cli | grep -v '^#' | grep -v -e '^[[:space:]]*$' | sed 's/\r//g' | jq --raw-input 'split(":")| {(.[0]): .[1]}' | jq -s add
pedroteixeira /
Created Nov 10, 2019
Export Google Chrome passwords to Firefox
# This is a little script to populate Firefox Sync with
# password exported from Google Chrome as csv. Use it like so:
# $> pip install PyFxA syncclient cryptography
# $> python ./
# It will prompt for your Firefox Account email address and
# password, csv file and upload password records, then
# sync down and print all password records stored in sync.

Consider a information model where each record is represented by an immutable tuple. This tuple in this context is called a fact.

Example of a fact:

('john', 'age', 18, true)

In this representation, the subject (or entity) 'john' has a value of '18' associated with the attribute 'age'.

To represent a deletion (or retraction) of information, the fourth element of the tuple can be 'false' to indicate that the corresponding entity's attribute no longer has that value.

pedroteixeira / bash
Last active Sep 26, 2018
Itau Guardiao Ubuntu 18
View bash
Baixe deb em
(ou em
sudo apt install python python-openssl python-six python-cryptography python-gpg
sudo dpkg --ignore-depends=libcurl3 --ignore-depends=python-gpgme -i warsaw-setup-ubuntu_64.deb
sudo vi /usr/bin/warsaw
pedroteixeira / prelude-js.el
Last active Aug 29, 2015
web-mode is not indenting correctly javascript (web-mode in jsx files)
View prelude-js.el
'(web-mode-attr-indent-offset nil)
'(web-mode-code-indent-offset 2)
'(web-mode-markup-indent-offset 2)
'(web-mode-indentation-params '("lineup-calls" . nil))
pedroteixeira / onbeforeunload.js
Last active Dec 27, 2015
onbeforeunload support for js navigation (via hashchange, such as backbone.history, etc)
View onbeforeunload.js
var cancelNavigate;
$(window).on("hashchange", function(ev) {
if(cancelNavigate) {
cancelNavigate = false;
return false;
if(window.onbeforeunload) {
var ok = confirm(window.onbeforeunload());
if(ok) {
window.onbeforeunload = null;
View robot.js
var Robot = function(robot){
robot.turnLeft(robot.angle % 90);
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
if (robot.parentId) {
else {
pedroteixeira / gp.clj
Created Sep 24, 2012
gaussian process regression
View gp.clj
(:use (incanter core stats)))
(set! *warn-on-reflection* true)
(def X (matrix [-4 -3 -1 0 2]))
(def Y (matrix [-2 0 1 2 -1]))
(def X* (matrix (range -5 5 0.2040816)))
pedroteixeira / console.rb
Created Sep 2, 2012
tip to test rails helper in console
View console.rb
class H; include MyHelper; end; h =
pedroteixeira / controller.rb
Created Aug 29, 2012
dynamic date+time acessors a datetime attribute in rails model
View controller.rb
# and you can handle formating in your controller
def action
params[:start_at] = params[:start_at_date] + ' ' + params[:start_at_time]
params.delete :start_at_date
params.delete :start_at_time
You can’t perform that action at this time.