Skip to content

Instantly share code, notes, and snippets.

@jbolila
jbolila / trrprefs.md
Created May 8, 2018 16:00 — forked from bagder/trrprefs.md
trr prefs

Preferences

All preferences for the DNS-over-HTTPS functionality in Firefox are located under the "network.trr" prefix (TRR == Trusted Recursive Resolver). The support for these landed in Firefox 60 but will be polished further in 61.

network.trr.mode

set which resolver mode you want.

0 - Off (default). use standard native resolving only (don't use TRR at all)

1 - Race native against TRR. Do them both in parallel and go with the one that returns a result first.

@jbolila
jbolila / rotary_encoder.rs
Created February 11, 2018 21:06
Rotary Encoder in Rust for Raspberry Pi
extern crate rppal;
use std::thread;
use std::sync::mpsc;
use std::time::Duration;
use rppal::gpio::{Gpio, Level, Mode};
use rppal::system::DeviceInfo;
const GPIO_PIN_CLK: u8 = 26;
@jbolila
jbolila / ip.lua
Last active October 31, 2017 07:28
module to shift ipv4 from ip to number and from number to ip
local ip = {}
function ip.to_number (ip_str)
if type(ip_str) ~= "string" then return -1 end
local chunks = { ip_str:match("(%d+)%.(%d+)%.(%d+)%.(%d+)") }
if #chunks == 4 then
for k , v in pairs(chunks) do
if tonumber(v) > 255 then return -1 end
chunks[k] = tonumber(v) or 0
@jbolila
jbolila / main.rs
Created October 6, 2017 16:34
Serde types + variation types and serde_json::Value::pointer fun learning Rust
#[macro_use]
extern crate serde_derive;
extern crate serde;
extern crate serde_json;
extern crate serde_yaml;
use std::collections::BTreeMap as Map;
#[derive(Serialize, Deserialize, Debug)]
@jbolila
jbolila / main.rs
Last active October 6, 2017 07:38
SetCookie for the next HTTP request using reqwest 0.8.0
extern crate reqwest;
extern crate cookie;
use std::time::Duration;
use cookie::{Cookie, CookieJar};
use reqwest::header::{Headers, SetCookie, UserAgent};
fn construct_headers(cookies: &SetCookie) -> Headers {
let mut headers = Headers::new();
@jbolila
jbolila / Dockerfile
Created August 16, 2016 21:14
Postgres latest (9.5) with Rust ready to Diesel_CLI
FROM postgres:latest
MAINTAINER Joao Bolila
ENV LC_ALL=C.UTF-8
RUN apt-get update
RUN apt-get -y install vim silversearcher-ag jq
RUN apt-get -y install build-essential git libsqlite3-dev libpq-dev
RUN cd /tmp ; git clone git://github.com/rkitover/vimpager ; cd vimpager ; make install-deb
@jbolila
jbolila / package.json
Created February 16, 2016 19:00
Elm simple make
{
"private": true,
"scripts": {
"postinstall": "npm start",
"start": "npm-run-all --parallel server watch:*",
"watch:elm": "chokidar ./src -c 'npm run build:elm' --initial",
"build": "npm-run-all build:*",
"build:elm": "elm-make src/*.elm --output js/elmapp.compiled.js --warn",
@jbolila
jbolila / Keybase proof.md
Last active August 29, 2015 14:21
Keybase proof

Keybase proof

I hereby claim:

  • I am jbolila on github.
  • I am jbolila (https://keybase.io/jbolila) on keybase.
  • I have a public key whose fingerprint is 853F 9D17 E5F9 2EE0 50C4 B276 6B5A F53C D39B B7C9

To claim this, I am signing this object:

@jbolila
jbolila / .ctags
Created November 22, 2013 10:48
ctags for Modern Perl
--recurse=yes
--tag-relative=yes
--exclude=.git
--langmap=perl:+.pod
--regex-perl=/package[ \t]+['"]*([A-Za-z][A-Za-z0-9:]+)['" \t]*;/\1/p,package,packages/
--regex-perl=/with[ \t]+['"]*([A-Za-z][A-Za-z0-9:]+)['" \t]*;/\1/w,role,roles/
--regex-perl=/extends[ \t]+['"]*([A-Za-z][A-Za-z0-9:]+)['" \t]*;/\1/e,extends/
--regex-perl=/use[ \t]+base[ \t]+['"]*([A-Za-z][A-Za-z0-9:]+)['" \t]*;/\1/e,extends/
--regex-perl=/use[ \t]+parent[ \t]+['"]*([A-Za-z][A-Za-z0-9:]+)['" \t]*;/\1/e,extends/