Skip to content

Instantly share code, notes, and snippets.

Carlo Perassi carlok

Block or report user

Report or block carlok

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@carlok
carlok / bitbucket-pipelines.yml
Last active Mar 28, 2020
How to force BitBucket to push a Docker image to AWS ECR after a git tag
View bitbucket-pipelines.yml
#image: atlassian/default-image:2
image: python:3.7.3
pipelines:
tags:
'v*': # the tag is "vSomething" like "v0.4.2"
- step:
name: Build docker image and push to AWS ECR
services:
- docker
@carlok
carlok / bitbucket-pipelines.yml
Created Mar 28, 2020
How to force BitBucket to push a Docker image to AWS ECR after a git tag
View bitbucket-pipelines.yml
#image: atlassian/default-image:2
image: python:3.7.3
pipelines:
tags:
'v*': # the tag is "vSomthing" like "v-0.4.2"
- step:
name: Build docker image and push to AWS ECR
services:
- docker
@carlok
carlok / keyFinder.js
Last active Mar 22, 2020
ES6 checking if exists an obj in a obj array with a given key/value
View keyFinder.js
// clean up based on
// https://medium.com/@rafaeloliveira1337/javascript-find-an-object-in-array-based-on-objects-property-8adb4fe421ce
// fiddle => https://jsfiddle.net/carlok/d5j4t67h/
const objArray = [
{ id: 0, name: 'Object 0', otherProp: '321' },
{ id: 1, name: 'foo', otherProp: '648' },
{ id: 2, name: 'Another Object', otherProp: '850' },
{ id: 3, name: 'Almost There', otherProp: '046' },
{ id: 4, name: 'foo2', otherProp: '984' }
@carlok
carlok / per_il_mondo_di_dopo.md
Last active Mar 22, 2020
Per il mondo di dopo
View per_il_mondo_di_dopo.md

Per il “mondo di dopo”

Il “mondo di prima” l'abbiamo lasciato di sicuro e non sappiamo come sarà quell dopo: qualcosa potrebbe cambiare per sempre, di grande e di piccolo.

Ho provato ad elencare alcune di queste variazioni.

  • Come in Oriente:
    • La stretta di mano, nata nel medioevo per mostrare che non si nascondevano né veleni né pugnali, potrebbe sparire. Vedo saluti, che ora trovo assurdi, con il gomito: un inchino orientale o una mano alzata come per un “ciao” potrebbero andare anche bene ma queste cose non si controllano.
    • Chi indosserà la mascherina per strada non verrà più considerato un ipocondriaco o un autentico malato ma solo una persona di buon senso.
    • Chi starnutirà o si soffierà il naso in pubblico verrà considerato un essere ripugnante.
@carlok
carlok / programmingLanguages
Last active Nov 30, 2019
languages I used in the last 30 years or so (I might have forgotten a few)
View programmingLanguages
assembly
awk
bash
basic
c
c#
c++
coffeescript
java
javascript
@carlok
carlok / line_counter.sh
Created Jul 4, 2019
Counting the number of textual files and their number of lines
View line_counter.sh
find A_LIST_OF_FOLDERS_AND_FILES -type f -exec grep -Iq . {} \; -print | wc -l
# A_LIST_OF_FOLDERS_AND_FILES => use the previous command as: find a b.txt c where a and c are directories or files
for a in $(find src -type f -exec grep -Iq . {} \; -print); do wc -l $a; done | awk '{split($0,a," "); sum += a[1]} END {print sum}'
@carlok
carlok / p3in-publish.py
Last active Jun 27, 2019
AMQP Python3 pika 1.0.0 publish/consume examples
View p3in-publish.py
#!/usr/bin/env python
import pika
# At the moment (2019-04-07) the official examples provided by CloudAMQP are not working anymore
# because pika 1.0.0 has changed
# moreover, the official examples are in Python 2
# these examples have a few benefits:
# they work with python3
# they work with pika 1.0.0
# they were tested with amqps
@carlok
carlok / istat.sql
Last active Apr 20, 2019
Script SQL per la memorizzazione dei Comuni, delle Province e delle Regioni d’Italia: si veda http://perassi.org/2011/01/18/sql-comuni-italiani/
View istat.sql
CREATE TABLE IF NOT EXISTS regioni (
id int(11) NOT NULL auto_increment,
nome varchar(100) NOT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS province (
id int(11) NOT NULL auto_increment,
nome varchar(100) NOT NULL,
id_regione int(11) NOT NULL,
@carlok
carlok / cloudwatch_logger_module.js
Created May 23, 2018
A simple Node.js module for logging on AWS CloudWatch using Winston
View cloudwatch_logger_module.js
"use strict";
let winston = require("winston");
let cloudWatchTransport = require("winston-aws-cloudwatch");
const set = function (options) {
let logger = new winston.Logger({
transports: [
new winston.transports.Console({
timestamp: true,
@carlok
carlok / hapi-awsses.js
Last active Apr 20, 2017
Hapi Plugin AWS SES (Nodemailer Promosificated)
View hapi-awsses.js
'use strict';
const Mailer = require('nodemailer');
const Ses = require('nodemailer-ses-transport');
exports.register = function (server, options, next) {
const sendTextMailPrm = function (to, subject, body) {
const mailOptions = {
from: options.from,
You can’t perform that action at this time.