Skip to content

Instantly share code, notes, and snippets.

View lmammino's full-sized avatar
🦁
Roar!

Luciano Mammino lmammino

🦁
Roar!
View GitHub Profile
@lmammino
lmammino / Recovery.md
Created March 17, 2014 17:18
Recover Mysql root password

1. Stopping the mysql daemon

/etc/init.d/mysql stopRun

2. Disable security checks and restart mysql

mysqld_safe --skip-grant-tables &
<?php
namespace Sbaam\Bundle\InviteBundle\Http;
use Symfony\Component\HttpFoundation\Response;
/**
* Class BlankPixelResponse
* @package Sbaam\Bundle\InviteBundle\Http
@lmammino
lmammino / supervisord
Last active July 20, 2021 12:24
init script and sample configuration for supervisor daemon
#!/bin/sh
#
# Based on a work of Miquel van Smoorenburg <[email protected]>
#
### BEGIN INIT INFO
# Provides: supervisor
# Required-Start: $remote_fs $network $named
# Required-Stop: $remote_fs $network $named
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6

Keybase proof

I hereby claim:

  • I am lmammino on github.
  • I am loige (https://keybase.io/loige) on keybase.
  • I have a public key whose fingerprint is 4553 AB20 F73B B53A 0159 BE56 FBA0 823A 8E8D 6234

To claim this, I am signing this object:

@lmammino
lmammino / example.js
Created February 6, 2016 17:56
Read only event emitter in Node
"use strict";
const ticker = require('./ticker');
ticker.on('tick', (tickCount) => console.log(tickCount, 'TICK'));
// ticker.emit('something', {}); <-- This will fail
@lmammino
lmammino / RandomWebToken.java
Last active October 20, 2021 18:35
A sample Java class that generates a URL safe random token
import java.security.SecureRandom;
import java.util.Base64;
import java.util.Base64.Encoder;
public class RandomWebToken
{
public static void main(String[] args)
{
SecureRandom random = new SecureRandom();
byte bytes[] = new byte[128];
/**
* Copyright (C) 2014 PONTON GmbH
*/
package org.efetnet.uti;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
import java.util.regex.Pattern;
@lmammino
lmammino / .npmrc-switch
Last active December 17, 2019 17:08
Simple bash script to switch from an NPM user login (profile) to another by using symlinks
#!/usr/bin/env bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
profile=$1
[ -z "$profile" ] && printf "\nERROR: missing profile name.\n\nUsage:\n\n '$0 <profileName>'\n" && exit 1
[ ! -f "$DIR/.npmrc-profiles/$profile" ] && printf "\nERROR: profile '$profile' not found\n" && exit 1
cd $DIR && ln -sf .npmrc-profiles/$profile .npmrc