Skip to content

Instantly share code, notes, and snippets.

Avatar

Rhagni Oliveira rhagni

View GitHub Profile
@rhagni
rhagni / adhoc.cmd
Created Apr 11, 2018
Windows 8 & 10 AdHoc command line helper
View adhoc.cmd
@ECHO OFF
IF "%1" EQU "check" GOTO:CHECK
IF "%1" EQU "setup" GOTO:SETUP
IF "%1" EQU "start" GOTO:START
IF "%1" EQU "stop" GOTO:STOP
IF "%1" EQU "show" GOTO:SHOW
IF "%1" EQU "enable" GOTO:ENABLE
IF "%1" EQU "disable" GOTO:DISABLE
IF "%1" EQU "help" GOTO:HELP
@rhagni
rhagni / .vimrc
Created Apr 11, 2018
Personal .vimrc
View .vimrc
let g:python_host_prog="C:\\bin\\python3\\python.exe"
let g:python3_host_prog="C:\\bin\\python3\\python.exe"
set nocompatible
filetype off
set rtp+=$HOME/.vim/bundle/Vundle.vim
call vundle#begin("\$HOME/.vim/bundle/")
Plugin 'VundleVim/Vundle.vim'
@rhagni
rhagni / server.ino
Last active Oct 21, 2018
ESP8266 NodeMCU example, simple http server blinking board led (First blinks at http request, second led keep blinking at interval)
View server.ino
#include <ESP8266WiFi.h>
#define Sprintf(data...) { \
Serial.printf(data); \
}
#define INITIATE_LED(led) { \
pinMode(led, OUTPUT); \
digitalWrite(led, LED_STATE_ON); \
}
View keybase.md

Keybase proof

I hereby claim:

  • I am rhagni on github.
  • I am rhagni (https://keybase.io/rhagni) on keybase.
  • I have a public key whose fingerprint is 8540 55AC FE8F 31D4 327F 8DA2 BFFF D67F 4983 5071

To claim this, I am signing this object:

@rhagni
rhagni / yaml2json.js
Last active May 24, 2017
Convert a YAML file to JSON using Nodejs
View yaml2json.js
"use strict";
// npm install yamljs
const YAML = require("yamljs");
const fs = require("fs");
const readline = require("readline");
@rhagni
rhagni / ultimate_str_replace.php
Created Aug 30, 2016
Some combinations of recommendations to str_replace catches from comments of official documentation
View ultimate_str_replace.php
<?php
/**
* Fastest and multimes str_replace
*
* Faster than str_replace when subject is an array and replace many times
* is possible from subject
*
*<code>
* $example = "<ht<html>ml> Malicious code </<html>html> etc";
* echo ultimate_str_replace(["<html>", "</html>"], "", $example);
@rhagni
rhagni / diff_floor_bitwiseOr.php
Created Jul 11, 2016
Difference between floor and bitwise OR, normally used to check status code of a request, being of category 2xx
View diff_floor_bitwiseOr.php
<?php
// https://3v4l.org/XCGmc
$code = 204;
$equals_to = 2;
// define("DEBUG", 1);