Skip to content

Instantly share code, notes, and snippets.

View rodolfobandeira's full-sized avatar

Rodolfo rodolfobandeira

View GitHub Profile
public class DistanceRootToNode {
public int Pathlength(Node root, int n1) {
if (root != null) {
int x = 0;
if ((root.data == n1) || (x = Pathlength(root.left, n1)) > 0
|| (x = Pathlength(root.right, n1)) > 0) {
return x + 1;
}
@rodolfobandeira
rodolfobandeira / agnoster.zsh-theme
Last active February 10, 2017 16:49
Agnoster ZSH theme with newline
# vim:ft=zsh ts=2 sw=2 sts=2
#
# agnoster's Theme - https://gist.github.com/3712874
# A Powerline-inspired theme for ZSH
#
# # README
#
# In order for this theme to render correctly, you will need a
# [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts).
# Make sure you have a recent version: the code points that Powerline
phamtomjs -v
2.1.1
curl http://repo1.maven.org/maven2/com/github/klieber/phantomjs/1.8.2/phantomjs-1.8.2-macosx.zip -o phantomjs-1.8.2.zip
unzip -x phantomjs-1.8.2.zip
which phantomjs
/usr/local/bin/phantomjs
mv ./phantomjs-1.8.2-macosx/bin/phantomjs /usr/local/bin/phantomjs
@rodolfobandeira
rodolfobandeira / README.md
Created April 25, 2017 18:32 — forked from chadrien/README.md
Debug PHP in Docker with PHPStorm and Xdebug

Debug your PHP in Docker with Intellij/PHPStorm and Xdebug

  1. For your local dev, create a Dockerfile that is based on your production image and simply install xdebug into it. Exemple:
FROM php:5

RUN yes | pecl install xdebug \
&& echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini \
@rodolfobandeira
rodolfobandeira / openbsd_pledge_test.c
Last active June 25, 2017 14:52
Testing OpenBSD pledge
#include <stdio.h>
#include <unistd.h>
#include <err.h>
int main() {
// if (-1 == pledge("stdio", NULL)) {
// Test passing a different "promise"
if (-1 == pledge("ioctl", NULL)) {
err(1, "pledge error detected");
@rodolfobandeira
rodolfobandeira / SMBDIS.ASM
Created October 17, 2017 02:18 — forked from 1wErt3r/SMBDIS.ASM
A Comprehensive Super Mario Bros. Disassembly
;SMBDIS.ASM - A COMPREHENSIVE SUPER MARIO BROS. DISASSEMBLY
;by doppelganger ([email protected])
;This file is provided for your own use as-is. It will require the character rom data
;and an iNES file header to get it to work.
;There are so many people I have to thank for this, that taking all the credit for
;myself would be an unforgivable act of arrogance. Without their help this would
;probably not be possible. So I thank all the peeps in the nesdev scene whose insight into
;the 6502 and the NES helped me learn how it works (you guys know who you are, there's no
@rodolfobandeira
rodolfobandeira / rxjs-firebase-demo.js
Created November 3, 2017 16:30 — forked from deltaepsilon/rxjs-firebase-demo.js
Demo RxJs integration with Firebase
var Rx = require('rxjs');
var firebase = require('firebase');
firebase.initializeApp({
"databaseURL": "https://quiver-two.firebaseio.com",
"serviceAccount": "./service-account.json"
});
var ref = firebase.database().ref('rxjs-demo');
Rx.Observable.fromPromise(ref.remove())
.map(function () {
openbsd_pledge_test_ioctl: file format elf64-x86-64
Disassembly of section .init:
0000000000000350 <__init>:
350: 48 83 ec 08 sub $0x8,%rsp
354: e8 07 01 00 00 callq 460 <__register_frame_info+0x10>
359: 48 83 c4 08 add $0x8,%rsp
35d: c3 retq
@rodolfobandeira
rodolfobandeira / rtwn.c
Created December 1, 2017 13:28
Source Code - rtwn.c on OpenBSD - Effort to add RTL8192SE driver
/* $OpenBSD: rtwn.c,v 1.36 2017/10/26 15:00:28 mpi Exp $ */
/*-
* Copyright (c) 2010 Damien Bergamini <[email protected]>
* Copyright (c) 2015 Stefan Sperling <[email protected]>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
Domain /dev/pci0:
0:0:0: Intel 82441FX
0x0000: Vendor ID: 8086 Product ID: 1237
0x0004: Command: 0103 Status: 0000
0x0008: Class: 06 Subclass: 00 Interface: 00 Revision: 02
0x000c: BIST: 00 Header Type: 00 Latency Timer: 00 Cache Line Size: 00
0x0010: BAR empty (00000000)
0x0014: BAR empty (00000000)
0x0018: BAR empty (00000000)
0x001c: BAR empty (00000000)