Skip to content

Instantly share code, notes, and snippets.

View c4milo's full-sized avatar
:octocat:

Camilo Aguilar c4milo

:octocat:
View GitHub Profile
@giannisp
giannisp / gist:ebaca117ac9e44231421f04e7796d5ca
Last active March 1, 2024 14:39
Upgrade PostgreSQL 9.6.5 to 10.0 using Homebrew (macOS)
After automatically updating Postgres to 10.0 via Homebrew, the pg_ctl start command didn't work.
The error was "The data directory was initialized by PostgreSQL version 9.6, which is not compatible with this version 10.0."
Database files have to be updated before starting the server, here are the steps that had to be followed:
# need to have both 9.6.x and latest 10.0 installed, and keep 10.0 as default
brew unlink postgresql
brew install postgresql@9.6
brew unlink postgresql@9.6
brew link postgresql
@tam7t
tam7t / certdump.go
Created September 1, 2016 19:02
certdump consul-template plugin for writing vault-generated certificates to separate files
package main
import (
"io/ioutil"
"log"
"os"
"os/user"
"strconv"
)
// Copyright 2016 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
// Command caption reads an audio file and outputs the transcript for it.
package main
import (
"fmt"
"io"
@FZambia
FZambia / main.go
Last active December 12, 2021 18:33
Verify armored GPG signature using Go language
package main
import (
"bytes"
"errors"
"fmt"
"io/ioutil"
"os"
"golang.org/x/crypto/openpgp/armor"
@c4milo
c4milo / component.js
Last active June 4, 2018 00:56
Simple breadcrumb Ember 2 component.
import Ember from 'ember';
export default Ember.Component.extend({
tagName: '', // Does not let Ember inject HTML into the component.
routing: Ember.inject.service('-routing'),
breadcrumbs: Ember.computed('routing.currentRouteName', function () {
let routeName = this.get('routing.currentRouteName');
let routeNames = routeName.split('.');
let len = routeNames.length;
@nhocki
nhocki / poller.go
Last active December 2, 2023 11:38
Simple task scheduling with Redis & Go. Similar to Sidekiq's `perform_in` and `perform_at`.
// poller.go
package main
import (
"fmt"
"os"
"os/signal"
"time"
git log --pretty="format:%an %ae" | sort | uniq -i | sort | sed -e 's/^ *[0-9]* //g' > AUTHORS
@nhocki
nhocki / aho_corasick.cpp
Created April 2, 2015 04:00
Aho-Corasick Algorithm in C++
///////////////////////////////////////////////////////////////
// Aho-Corasick's algorithm, as explained in //
// http://dx.doi.org/10.1145/360825.360855 //
///////////////////////////////////////////////////////////////
// Max number of states in the matching machine.
// Should be equal to the sum of the length of all keywords.
const int MAXS = 6 * 50 + 10;
// Number of characters in the alphabet.
@ryanuber
ryanuber / raft-boltdb
Last active August 29, 2015 14:14
Raft backend benchmarks
BenchmarkBoltStore_FirstIndex-5 1000000 1932 ns/op
BenchmarkBoltStore_LastIndex-5 1000000 1907 ns/op
BenchmarkBoltStore_GetLog-5 300000 5931 ns/op
BenchmarkBoltStore_StoreLog-5 5000 266819 ns/op
BenchmarkBoltStore_StoreLogs-5 5000 300801 ns/op
BenchmarkBoltStore_DeleteRange-5 5000 322467 ns/op
BenchmarkBoltStore_Set-5 10000 247162 ns/op
BenchmarkBoltStore_Get-5 1000000 2176 ns/op
BenchmarkBoltStore_SetUint64-5 10000 240333 ns/op
BenchmarkBoltStore_GetUint64-5 1000000 2209 ns/op
@indexzero
indexzero / README.md
Last active August 29, 2015 14:12
Myo C++ Header files. Who wants to write a node binding for this?

The state of Myo bindings in Node.js

... any takers? Comment on this gist! The discussion all started from a Tweet:

Who's going to be the first to write a wrapper for the @thalmic #myo C++ library? Latest headers: https://gist.github.com/indexzero/60d1224f0082f0d16f14

As pointed out by @c4milo there are a number of libraries that exist, but from first glance they all have deficiencies: