Skip to content

Instantly share code, notes, and snippets.


Claudio Cicali claudioc

View GitHub Profile
View BTC historic data up to may 2021
2015-01-27, 1422306000, 261.50871632545
2015-01-28, 1422392400, 252.94129752347
2015-01-29, 1422478800, 233.50756537828
2015-01-30, 1422565200, 234.11944239152
2015-01-31, 1422651600, 229.29348122967
2015-02-01, 1422738000, 219.59582099483
2015-02-02, 1422824400, 226.80453426543
2015-02-03, 1422910800, 236.74507558732
2015-02-04, 1422997200, 225.77968577082
claudioc /
Last active Feb 20, 2021
A script to create and set a github repo up
#!/usr/bin/env bash
# Creates a new github repository with all our nice defaults,
# using a template repository
# Installation:
# - cd ~/bin
# - ln -s <this file>
# Running
# `git create-repo [name of the new repo (optional)]`
claudioc / gist:aed152ceebdc8936dd0f4a0009893cdc
Created Jan 7, 2021
Fastest way to create an EC2 machine with Amazon provided SSL certificates (?)
View gist:aed152ceebdc8936dd0f4a0009893cdc
Since you can only use ACM provided certificates from (A/N/E)LB or CloudFormation, I think this
could be the easiest way (using ALB).
- (EC2) Create a security group that only accepts HTTPS
- (EC2) Create a security group that only accepts HTTP connection from the security group above
- (EC2) Create the EC2 instance and bind it to the the security group above
- (EC2) Create a Target Group and use the above EC2 as the target inside it
- (ACM) Create the SSL certificate in ACM (hint: you can create it directly from Route53)
- (EC2) Create an Application Load Balancer in the same EC2's AZs using the above target group and the SSL certificate
- (Route53) Edit your DNS zone to add the LB A record (use its Alias and autocomplete)
claudioc /
Created Aug 30, 2020
The secretary problem
#!/usr/bin/env python
import random
from math import e
n_runs = 1000
n_scores = 1000
score_max = 1000000
def main():
claudioc /
Created May 29, 2020
Script which finds the newest screenshot image and adds a shadow to it
#!/usr/bin/env bash
if [ $# -eq 0 ]; then
echo "Needs the filename as the first argument"
exit -1
type /usr/local/bin/convert >/dev/null 2>&1 || { echo >&2 "The convert command must be available."; exit 1; }
claudioc / user.screenshot.drop_shadow.plist
Last active May 29, 2020
Plist file to execute a custom script when a directory changes
View user.screenshot.drop_shadow.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
View fs-api.ts
import * as fs from 'fs'
import * as path from 'path'
import { promisify } from 'util'
// About returning promises inside an async ts method
type ScanDirOptions = {
match?: RegExp
exclude?: RegExp
View gist:0e7b1f85eb3449258faf8cb94ea8a2c7
-- Contenuto del tsconfig.json
// Enable support for importing CommonJS modules targeting es6 modules
"esModuleInterop": true,
// When using above interop will get missing default export error from type check since
// modules use "export =" instead of "export default", enable this to ignore errors.
"allowSyntheticDefaultImports": true
claudioc /
Last active Aug 13, 2018
Simplest git shortcuts wrapper
#!/usr/bin/env bash
# Simple shortcut wrapper to your most common git commands
# Easy to extend, and passes all the unrecognized command through the
# `git` command itself (i.e. `g rebase master` => `git rebase master`)
# Traps any error (see
set -e -o pipefail -u
View method_missing.js
/* This can be the start of a module */
const makeHandler = cb => {
return {
get (object, prop, receiver) {
if (Reflect.has(object, prop)) {
return Reflect.get(...arguments)
return new Proxy(() => {}, {