Skip to content

Instantly share code, notes, and snippets.

View naxhh's full-sized avatar
💻
Devoping

Ignacio Tolstoy naxhh

💻
Devoping
  • Barcelona
View GitHub Profile
@naxhh
naxhh / Throttle with public key
Created September 13, 2012 19:51
Throttle APP ID based on APP public token
/**
* This is based on the idea you have an authorization class done with:
* auth.getToken to generate a token based on a ID and a password
* auth.checkToken to validate this token (returning the ID of the app to use in req.username)
*
* NOTES:
* I use a redis loader to set redis instance in res.locals
*
* I set burst and rate to 1 to easy check the override and the system working
*/
@naxhh
naxhh / gist:3907966
Created October 17, 2012 20:32
Hands on git console

In order to force myself to use git commands and not GUI I put here commands I may need.

Common use commands

Create/Switch branches

git checkout <branch>
git checkout -b <branchname> origin/<branch>
@naxhh
naxhh / Sublime text2 file ignore
Created October 17, 2012 20:45
Avoid files&folders to project
{
"folders":
[
{
"path": "/C/xampp/htdocs/l4c.me",
"folder_exclude_patterns": ["node_modules", "logs", "-p", "tmp"],
"file_exclude_patterns": ["*.gitignore", "*.sample", "*.md"]
}
]
}
@naxhh
naxhh / Mongo utilities
Created October 29, 2012 12:46
Useful mongo-shell-admin commands
# Login admin
> use admin
> db.auth('user','pass')
#Basic shows
> show dbs
> show collections
> db.collection.getIndexes()
#Create Index
### Keybase proof
I hereby claim:
* I am naxhh on github.
* I am nax (https://keybase.io/nax) on keybase.
* I have a public key whose fingerprint is 15D7 69FE 422E 1A3F 5DFB DDD4 6810 EE31 37A8 BF52
To claim this, I am signing this object:
@naxhh
naxhh / gist:e85bd52715e856b73e1d
Last active March 1, 2017 16:24
Behat Scenario parser
<?php
require __DIR__ . '/vendor/autoload.php';
$features_path = __DIR__ . 'test/Behat/';
$project = 'project';
$keywords = new Behat\Gherkin\Keywords\CachedArrayKeywords( __DIR__ . '/vendor/behat/gherkin/i18n.php' );
$lexer = new Behat\Gherkin\Lexer($keywords);
$parser = new Behat\Gherkin\Parser($lexer);
@naxhh
naxhh / interpreter.rkt
Last active January 15, 2019 10:05
MUPL interpreter in racket
#lang racket
(provide (all-defined-out)) ;; so we can put tests in a second file
;; definition of structures for MUPL programs
(struct var (string) #:transparent) ;; a variable, e.g., (var "foo")
(struct int (num) #:transparent) ;; a constant number, e.g., (int 17)
(struct add (e1 e2) #:transparent) ;; add two expressions
(struct ifgreater (e1 e2 e3 e4) #:transparent) ;; if e1 > e2 then e3 else e4
(struct fun (nameopt formal body) #:transparent) ;; a recursive(?) 1-argument function
(struct call (funexp actual) #:transparent) ;; function call
@naxhh
naxhh / turkish-love.php
Last active August 29, 2015 14:10
PHP POC of an error
<?php
/**
* POC of an error.
*
* Error log was confusing:
*
* PHP Fatal error: Call to undefined method Config::getClassInfo() in /path/Config.php on line 475
* PHP Fatal error: Class 'GetEnvironmentInfo' not found in /path/autoprepend5.lib.php on line 327
*
* Finally problem was related to I18N class.
@naxhh
naxhh / keybase.md
Created March 22, 2015 19:35
keybase

Keybase proof

I hereby claim:

  • I am naxhh on github.
  • I am nax (https://keybase.io/nax) on keybase.
  • I have a public key whose fingerprint is 5A2F 8C93 E77B D548 8715 9CD8 BF85 FA9A F8DF ED6E

To claim this, I am signing this object:

@naxhh
naxhh / gist:e5eafaa0813fb59fb69e
Created January 13, 2016 17:22
2016 proposals you will never do...
- Finish 1st scala course (coursera)
- Start and finish 2nd scala course (coursera)
- Learn android development (at least 1 usefull app, camlistore app?)
- .?