Skip to content

Instantly share code, notes, and snippets.

View bsorrentino's full-sized avatar
💭
passion is fuel for life

bsorrentino bsorrentino

💭
passion is fuel for life
View GitHub Profile
@bsorrentino
bsorrentino / README.md
Last active July 29, 2022 16:05
PlantUML Experience

PlantUML Experience

PlantUML in Docker

To install PlantUML for those platforms that do not provide its native packages see the following project [plantuml-install]

[PlantUML Hitchhikers Guide]

@[Crashedmind] wrote this guide as part of his own “Journey to Documentation as Code” using [PlantUML] as the main tools for proposing, analysing, documenting, maintaining software systems based on working with thousands of engineers across the globe.

Language

@bsorrentino
bsorrentino / Manage Multi-Tenant Webapps using Nodewebkit on Macosx
Last active July 23, 2019 21:01
Manage Multi-Tenant Webapps using Nodewebkit on Macosx
# GIST's Title
@bsorrentino
bsorrentino / video2gif.md
Created January 3, 2019 22:20
Transform Video to Animated GIF

Tranform video to images ffmpeg

ffmpeg -i <your video file> -vf fps=1 images/img%04d.png

Tranform images to animated gif using gifski

gifski -o .gif --fps 1 images/*.png
@bsorrentino
bsorrentino / config-props.md
Created August 24, 2018 14:18 — forked from dsyer/config-props.md
Notes on Dynamic Configuration Properties

Dynamic Configuration Properties in Spring Boot and Spring Cloud

TL;DR

  • Use @ConfigurationProperties and always get state from the bean.
  • The Environment can change at runtime and Spring Cloud does this for you using RefreshEvent.
  • Changes are propagated to beans in Spring Cloud in 2 ways (@ConfigurationProperties and @RefreshScope).
  • If you care about the state of @ConfigurationProperties being consistent on concurrent access, put it or the consumer @Bean in @RefreshScope.

Typical Scenarios

@bsorrentino
bsorrentino / docker_desc.sh
Created April 3, 2018 21:33 — forked from mlinhard/docker_desc.sh
Shell script to find docker image descendants
#!/bin/bash
parent_short_id=$1
parent_id=`docker inspect --format '{{.Id}}' $1`
get_kids() {
local parent_id=$1
docker inspect --format='ID {{.Id}} PAR {{.Parent}}' $(docker images -a -q) | grep "PAR ${parent_id}" | sed -E "s/ID ([^ ]*) PAR ([^ ]*)/\1/g"
}
print_kids() {
@bsorrentino
bsorrentino / test.html
Created July 27, 2017 13:02
GA 2D engine - hitTestCircleRectangle issue
<!doctype html>
<meta charset = "utf-8">
<title>SUBMARINE</title>
<body>
<script src="ga.js"></script>
<script src="plugins.js"></script>
<script type="text/javascript">
@bsorrentino
bsorrentino / getDPI.js
Last active February 11, 2023 03:25
Get DPI from javascript (live at: https://jsfiddle.net/bsorrentino/s8c51jvt/)
//
// inspired by https://stackoverflow.com/a/838755/521197
//
function getDPI() {
var div = document.createElement( "div");
div.style.height = "1in";
div.style.width = "1in";
div.style.top = "-100%";
div.style.left = "-100%";
div.style.position = "absolute";
@bsorrentino
bsorrentino / broadcasterTest.js
Created April 12, 2017 12:44
Battery Mode using Cordova Broadcaster Plugin
var exec = require('cordova/exec');
exports.startMonitoringPowerState = function(success, error) {
exec(success, error, "broadcasterTest", "startMonitoringPowerState", []);
};
@bsorrentino
bsorrentino / script.js
Last active March 17, 2017 09:48
Weird2JSON
function WEIRDtoJSON( weirdProtocol ) {
var pattern = /\#\$\*\sSBR_DEALERGROUP_TARGET\.TARGET(\d+)\slookup\s\*%\d+%([\w\d]+%)/g
var res = weirdProtocol.replace( pattern, "$2" );
var token = res.split('%');
var result = []; var i=0;
while( i < token.length-1 ) {
result.push( {
TYPE:token[i++],
@bsorrentino
bsorrentino / rxjs-patching.js
Created January 21, 2017 07:52 — forked from ericelliott/rxjs-patching.js
Reduce bundle size with RxJS patching
import { Observable } from 'rxjs/Observable';
// then patch import only needed operators:
import 'rxjs/add/operator/map';
import 'rxjs/add/observable/from';
const foo = Observable.from([1, 2, 3]);
foo.map(x => x * 2).subscribe(n => console.log(n));