Skip to content

Instantly share code, notes, and snippets.

View cdibened's full-sized avatar

Cesidio Di Benedetto cdibened

View GitHub Profile
@cdibened
cdibened / aws_lambda_public_ip.js
Created July 11, 2020 14:20 — forked from kixorz/aws_lambda_public_ip.js
Function retrieving AWS Lambda public IP address. Copy and paste this to your Lambda console, use standard permissions, execute and observe the log to see the public IP address of your Lambda function.
var http = require('http');
exports.handler = function(event, context) {
http.get('http://httpbin.org/get', function(res) {
var body = '';
res.on('data', function(chunk) {
body += chunk;
});
res.on('end', function() {
@cdibened
cdibened / encoding_repairer.rb
Created May 19, 2020 22:03 — forked from xijo/encoding_repairer.rb
Repair utf-8 strings that contain iso-8599 encoded utf-8 characters
class EncodingRepairer
REPLACEMENTS = {
"€" => "€", "‚" => "‚", "„" => "„", "…" => "…", "ˆ" => "ˆ",
"‹" => "‹", "‘" => "‘", "’" => "’", "“" => "“", "â€" => "”",
"•" => "•", "–" => "–", "—" => "—", "Ëœ" => "˜", "â„¢" => "™",
"›" => "›", "Å“" => "œ", "Å’" => "Œ", "ž" => "ž", "Ÿ" => "Ÿ",
"Å¡" => "š", "Ž" => "Ž", "¡" => "¡", "¢" => "¢", "£" => "£",
"¤" => "¤", "Â¥" => "¥", "¦" => "¦", "§" => "§", "¨" => "¨",
"©" => "©", "ª" => "ª", "«" => "«", "¬" => "¬", "®" => "®",
# (c) 2020 Humu
# MIT License
from typing import Any
import github
AUTOMERGE_LABEL_NAME = 'automerge'
Verifying that "cesidio.id" is my Blockstack ID. https://onename.com/cesidio
@cdibened
cdibened / gist:9295104
Last active August 29, 2015 13:56
Phonegap can write to file but not read newly created file on Android
var fe, fs;
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(fs) {
gotFS(fs,file);
}, fail);
function gotFS(fileSystem, file) {
var flags = {create: true, exclusive: false};
fileSystem.root.getDirectory("mytmp", flags,
function(parent){
@cdibened
cdibened / tail
Created August 7, 2013 20:05
custom script to alias the unix "tail" utility so that you can specify number of screens in addition to the standard number of lines
#!/bin/sh
screenheight=`echo "lines"|tput -S`
lines=50
file=`echo "${@: -1}"`
while getopts s:l: option
do
case "${option}"
in
{
// --------------------------------------------------------------------
// JSHint Configuration, Strict Edition
// --------------------------------------------------------------------
//
// This is a options template for [JSHint][1], using [JSHint example][2]
// and [Ory Band's example][3] as basis and setting config values to
// be most strict:
//
// * set all enforcing options to true
@cdibened
cdibened / flexbox-layout.css
Last active December 18, 2015 01:48
First iteration of some default css rules to support new and old flex-box models
/* root containers*/
.flex-horiz,
.flex-vert {
/* old */
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
/* new */
display: -webkit-flex;