Skip to content

Instantly share code, notes, and snippets.

View aitoroses's full-sized avatar

Aitor Oses aitoroses

View GitHub Profile
@aitoroses
aitoroses / .hyper.js
Last active May 17, 2019 06:16
Hyper terminal configuration together with pure for zsh
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// choose either `'stable'` for receiving highly polished,
// or `'canary'` for less polished but more frequent updates
updateChannel: 'stable',
@aitoroses
aitoroses / Show.re
Created April 3, 2019 07:14
ReasonML adhoc polymorphism
module type SHOW = {
type t
let show: t => string
};
type show_impl('a) = (module SHOW with type t = 'a)
module Show_int: SHOW with type t = int = {
type t = int;
let show = string_of_int
@aitoroses
aitoroses / baby-lisper.js
Created April 16, 2018 14:38 — forked from jameslaneconkling/baby-lisper.js
A silly simple lisp parser in javascript
const rules = [
{ type: 'space', regex: /^\s/ },
{ type: 'lParen', regex: /^\(/ },
{ type: 'rParen', regex: /^\)/ },
{ type: 'number', regex: /^[0-9\.]+/ },
{ type: 'string', regex: /^".*?"/ },
{ type: 'variable', regex: /^[^\s\(\)]+/ } // take from the beginning 1+ characters until you hit a ' ', '(', or ')' // TODO - support escaped double quote
];
https://www.youtube.com/watch?v=iumlHzoVlJM
class Perceptron {
constructor (x_train, y_train, epochs=1000, learn_rate= 0.1) {
// used to generate percent accuracy
this.accuracy = 0
this.samples = 0
this.x_train = x_train
@aitoroses
aitoroses / kmskeys10.txt
Created November 11, 2017 15:26 — forked from CHEF-KOCH/kmskeys10.txt
Windows 10 KMS Keys
Windows.10.and.Office.2016.gVLK
#####################################################################
# Install/Uninstall keys #
#####################################################################
1.) Uninstall the current product by entering the “uninstall product key” extension:
slmgr.vbs /upk
2.) Install the key that you obtained above for “Windows Srv 2012R2 DataCtr/Std KMS for Windows 10”
@aitoroses
aitoroses / disable_nsurlsessionid.sh
Created August 21, 2017 15:09 — forked from akhy/disable_nsurlsessionid.sh
Disable NSURLSessionId
launchctl unload /System/Library/LaunchDaemons/com.apple.nsurlstoraged.plist
launchctl unload /System/Library/LaunchAgents/com.apple.nsurlsessiond.plist
sudo launchctl unload /System/Library/LaunchDaemons/com.apple.nsurlsessiond.plist
sudo launchctl unload /System/Library/LaunchDaemons/com.apple.nsurlstoraged.plist
@aitoroses
aitoroses / app.ts
Last active June 1, 2017 08:33
Using angular DI to create a node app (POC)
import { bootstrap, Request, Response, MongooseFactory, Injectable } from './library'
@Injectable()
class UserModel {
private model
constructor(modelFactory: MongooseFactory) {
this.model = modelFactory.createModel('users', mongoose.Schema({
name: String
@aitoroses
aitoroses / Maybe.ts
Created May 31, 2017 11:12
Maybe Monad
interface MaybePattern<A, B> {
Just: (a: A) => B,
Nothing: () => B
}
class Maybe<A> {
static of<A>(a: A): Maybe<A> {
return a ? new Just(a) : new Nothing()
@aitoroses
aitoroses / typescript-pattern-matching.ts
Created May 27, 2017 11:12 — forked from rob3c/typescript-pattern-matching.ts
TypeScript pattern matching proof-of-concept
// preserved from my comment in this issue: https://github.com/Microsoft/TypeScript/issues/165#issuecomment-259598080
interface Type<T> { new(...args): T }
interface CaseResult<R> {
success: boolean;
result: R;
}
interface CaseFn<R> { (value: any): CaseResult<R> }
@aitoroses
aitoroses / 3_nodes.sh
Created May 22, 2017 16:10
configuring glusterfs
# Assumming we have 3 nodes
NODE1=10.0.1.1
NODE2=10.0.1.2
NODE3=10.0.1.3
# Configure the server
ssh root@NODE1 apt-get install -y glusterfs-server
ssh root@NODE2 apt-get install -y glusterfs-server
ssh root@NODE3 apt-get install -y glusterfs-server
ssh root@NODE1 gluster peer probe NODE2