Skip to content

Instantly share code, notes, and snippets.

View PabloValor's full-sized avatar

Pablo Valor PabloValor

  • Despegar.com
  • Buenos Aires, Argentina
View GitHub Profile
//Write a function that takes a string, and returns the character that is most commonly used in the string.
interface LetterCounter {
letter: string
count: number
}
function getMostCommonlyChar(input: string): string {
const letterCounter: LetterCounter[] = []
rm ~/Library/Preferences/com.bjango.istatmenus.plist
@PabloValor
PabloValor / mysql-docker.sh
Created November 18, 2018 15:15 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@PabloValor
PabloValor / gist:1bb0dd1953d83fec259fa5c1c88cdc92
Created August 28, 2018 23:25
Ejecutar comando de contenedor
#Dockerfile
FROM node:8
RUN npm install -g sails
WORKDIR /usr/src/app
ENTRYPOINT ["sails"]
# acceder al cli de sails desde afuera:
docker run -it --rm -v $PWD:/usr/src/app sails lift
@PabloValor
PabloValor / mongo_backup.sh
Created May 27, 2018 15:35 — forked from sheharyarn/mongo_backup.sh
Mongodump Shell Script for Cronjob
#!/bin/bash
MONGO_DATABASE="your_db_name"
APP_NAME="your_app_name"
MONGO_HOST="127.0.0.1"
MONGO_PORT="27017"
TIMESTAMP=`date +%F-%H%M`
MONGODUMP_PATH="/usr/bin/mongodump"
BACKUPS_DIR="/home/username/backups/$APP_NAME"
@PabloValor
PabloValor / KeystoneApiExample.md
Created November 12, 2016 14:20 — forked from JedWatson/KeystoneApiExample.md
Example of how to scaffold API endpoints for Posts in a Keystone project (based on the yo keystone example).

This is an example of how to scaffold API endpoints to list / get / create / update / delete Posts in a Keystone website.

It's a modification of the default project created with the yo keystone generator (see https://github.com/JedWatson/generator-keystone)

Gists don't let you specify full paths, so in the project structure the files would be:

routes-index.js        -->    /routes/index.js         // modified to add the api endpoints
routes-api-posts.js    -->    /routes/api/posts.js     // new file containing the Post API route controllers
@PabloValor
PabloValor / app.js
Last active August 29, 2015 14:25 — forked from sogko/app.js
'use strict';
// simple express server
var express = require('express');
var app = express();
var router = express.Router();
app.use(express.static('public'));
app.get('/', function(req, res) {
res.sendfile('./public/index.html');
@PabloValor
PabloValor / t.js
Last active August 29, 2015 14:12
function post() {
$(".masdiez a").click();
$.ajax({
type: 'POST',
url:'http://www.taringa.net/borradores-agregar.php',
async: false,
data:{
"key":global_data.user_key,
"id":"",
"borrador_id":"",