Skip to content

Instantly share code, notes, and snippets.

@durango
durango / cloud-nlp.js
Created April 22, 2017 19:16 — forked from sararob/cloud-nlp.js
Call the Cloud Natural Language API from Node.js
'use strict';
const fs = require('fs');
const ndjson = require('ndjson');
const request = require('request');
fs.createReadStream('reddit-comments.json') // Newline delimited JSON file
.pipe(ndjson.parse())
.on('data', function(obj) {
func authenticateBearer(c *echo.Context) error {
// Look for an Authorization header
if ah := c.Request().Header.Get("Authorization"); ah != "" {
// Should be a bearer token
if len(ah) > 6 && ah[0:6] == "Bearer" {
// Parse rest of header and verify with the secret
if token, err := jwt.Parse(ah[7:], tokenSecret); err == nil && token.Valid {
c.Set("token", token)
return nil
@durango
durango / app.html
Created July 8, 2017 17:48 — forked from jdanyow/app.html
Aurelia autocomplete
<template>
<require from="./autocomplete"></require>
<form>
<label class="form-component">
Country
<autocomplete service.bind="countryNameService"
value.bind="countryName"
placeholder="Country">
</autocomplete>
</label>
@durango
durango / sepsplit.c
Created November 26, 2017 12:46 — forked from xerub/sepsplit.c
/*
* SEP firmware split tool
*
* Copyright (c) 2017 xerub
*/
#include <fcntl.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
@durango
durango / channels.rs
Created December 23, 2017 02:42 — forked from jakejscott/channels.rs
rust channels and threads
use std::thread;
use std::sync::mpsc::channel;
use std::sync::mpsc::sync_channel;
// Create a simple streaming channel
fn example1() {
// (tx for transmission)
// (rx for receiving)
let (tx, rx) = channel();
@durango
durango / and_select.rs
Created December 24, 2017 14:46 — forked from alex-shapiro/and_select.rs
An "AND" version of the futures stream combinator
//! An adapter for merging the output of two streams, where
//! the stream resolves as soon either stream resolves.
use futures::{Poll, Async};
use futures::stream::{Stream, Fuse};
pub struct AndSelect<S1, S2> {
stream1: Fuse<S1>,
stream2: Fuse<S2>,
flag: bool,
@durango
durango / main.go
Created January 8, 2018 15:58 — forked from enricofoltran/main.go
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
@durango
durango / compiling_building_c_cpp_notes.md
Created January 20, 2018 21:15 — forked from gubatron/compiling_building_c_cpp_notes.md
Things to remember when compiling and linking C/C++ programs

Things to remember when compiling/linking C/C++ software

by Angel Leon. March 17, 2015.

Include Paths

On the compilation phase, you will usually need to specify the different include paths so that the interfaces (.h, .hpp) which define structs, classes, constans, and functions can be found.

With gcc and llvm include paths are passed with -I/path/to/includes, you can pass as many -I as you need.

In Windows, cl.exe takes include paths with the following syntax: /I"c:\path\to\includes\ you can also pass as many as you need.

@durango
durango / disable.sh
Created May 10, 2018 02:55
Disable bunch of #$!@ in Sierra (Version 2.1)
#!/bin/bash
# IMPORTANT: You will need to disable SIP aka Rootless in order to fully execute this script, you can reenable it after.
# WARNING: It might disable things that you may not like. Please double check the services in the TODISABLE vars.
# Get active services: launchctl list | grep -v "\-\t0"
# Find a service: grep -lR [service] /System/Library/Launch* /Library/Launch* ~/Library/LaunchAgents
# Agents to disable
TODISABLE=('com.apple.security.keychainsyncingoveridsproxy' 'com.apple.personad' 'com.apple.passd' 'com.apple.screensharing.MessagesAgent' 'com.apple.CommCenter-osx' 'com.apple.Maps.mapspushd' 'com.apple.Maps.pushdaemon' 'com.apple.photoanalysisd' 'com.apple.telephonyutilities.callservicesd' 'com.apple.AirPlayUIAgent' 'com.apple.AirPortBaseStationAgent' 'com.apple.CalendarAgent' 'com.apple.DictationIM' 'com.apple.iCloudUserNotifications' 'com.apple.familycircled' 'com.apple.familycontrols.useragent' 'com.apple.familynotificationd' 'com.apple.gamed' 'com.apple.icloud.findmydeviced.findmydevi
@durango
durango / .eslintrc
Created September 7, 2018 13:35 — forked from alefteris/.eslintrc
ESLint default config in YAML format
---
parser: espree
env:
amd: false
browser: false
es6: false
jasmine: false
jquery: false
meteor: false
mocha: false