Skip to content

Instantly share code, notes, and snippets.

View adnaan's full-sized avatar
🎯
Focusing

Adnaan Badr adnaan

🎯
Focusing
View GitHub Profile
@rafaelbeckel
rafaelbeckel / Eng-manager.md
Created May 3, 2019 02:43
Engineering Manager Role Description

From JimDabell's comment on Hacker News: https://news.ycombinator.com/item?id=18355568

Off the top of my head, these are the kinds of things engineering managers often have to deal with:

Hiring:

  • Writing job specs.
  • Dealing with recruiters
  • Reading CVs/résumés
  • Interviews
@donmccurdy
donmccurdy / wildcard-to-regexp.js
Last active February 21, 2024 06:49
Wildcard and glob matching in JavaScript.
/**
* Creates a RegExp from the given string, converting asterisks to .* expressions,
* and escaping all other characters.
*/
function wildcardToRegExp (s) {
return new RegExp('^' + s.split(/\*+/).map(regExpEscape).join('.*') + '$');
}
/**
* RegExp-escapes all characters in the given string.
@wojteklu
wojteklu / bayes.go
Created February 28, 2017 20:58
Multinomial naive Bayes classifier
package bayes
// Classifier implements the Naive Bayes Classifier.
type Classifier struct {
classPerWordCount map[string]int
classPerDocument map[string]int
wordClassCount map[string]map[string]int
documentsCount int
}
@oscarrenalias
oscarrenalias / README.md
Last active September 27, 2020 18:46
Docker service discovery with HAproxy, consul and registrator on Docker Machine and Docker Swarm
@sweis
sweis / Crypfs.java
Last active September 30, 2015 04:59
Cryptfs from Secret's Android App
//package ly.secret.android.net;
/**
* This is source code derived from the Cryptfs class found in Secret.ly's android app.
*
* Comments and variable names are my own.
*
* Here's how I generated this file:
* 1. Downloaded the Secret.ly APK via this link:
* http://storage.evozi.com/apk/dl/14/05/21/ly.secret.android.apk?vc=1600040
@gipi
gipi / repo-apply.sh
Last active April 4, 2023 05:10
Split a patch created with repo diff in a set of usable patches
#!/bin/sh
## Script to patch up diff reated by `repo diff`
# from https://groups.google.com/d/msg/repo-discuss/43juvD1qGIQ/7maptZVcEjsJ
if [ -z "$1" ] || [ ! -e "$1" ]; then
echo "Usages: $0 <repo_diff_file>";
exit 0;
fi
rm -fr _tmp_splits*
@andyvr
andyvr / gist:5205764
Last active February 3, 2018 02:11
This is the Angular.js directive that converts html select boxes with Angularjs bindings into the Twitter Bootstrap dropboxes. See examples on jsfiddle: http://jsfiddle.net/M32pj/28/
angular.module('bsselect', [])
.directive('bsSelectbox', function ($parse) {
return {
restrict: 'A',
priority: 100,
transclude: true,
scope: {
themodel: '=ngModel',
thearray: '@ngOptions',
thechange: '&ngChange',
@rday
rday / gist:3504674
Created August 28, 2012 21:52
Abstract wrapper to allow connection pools
type InitFunction func() (interface{}, error)
type ConnectionPoolWrapper struct {
size int
conn chan interface{}
}
/**
Call the init function size times. If the init function fails during any call, then
the creation of the pool is considered a failure.
@tobyhede
tobyhede / postsql.sql
Created May 17, 2012 03:08
PostgreSQL as JSON Document Store
-- PostgreSQL 9.2 beta (for the new JSON datatype)
-- You can actually use an earlier version and a TEXT type too
-- PL/V8 http://code.google.com/p/plv8js/wiki/PLV8
-- Inspired by
-- http://people.planetpostgresql.org/andrew/index.php?/archives/249-Using-PLV8-to-index-JSON.html
-- http://ssql-pgaustin.herokuapp.com/#1
-- JSON Types need to be mapped into corresponding PG types
--