Skip to content

Instantly share code, notes, and snippets.

View frapontillo's full-sized avatar

Francesco Pontillo frapontillo

View GitHub Profile
@frapontillo
frapontillo / upsource-load-balancer.yaml
Last active August 29, 2015 14:27
Multiple pods on same cluster/port
apiVersion: v1
kind: Service
metadata:
labels:
name: upsource-service
name: upsource-service
spec:
type: LoadBalancer
ports:
- # The port that this service should serve on.
@frapontillo
frapontillo / android-update.sh
Last active August 29, 2015 14:27
Android SDK CLI Update
root@b700d288820c:/opt# android list sdk --extended --all
Refresh Sources:
Fetching https://dl.google.com/android/repository/addons_list-2.xml
Validate XML
Parse XML
Fetched Add-ons List successfully
Refresh Sources
Fetching URL: https://dl.google.com/android/repository/repository-11.xml
Validate XML: https://dl.google.com/android/repository/repository-11.xml
Parse XML: https://dl.google.com/android/repository/repository-11.xml
@frapontillo
frapontillo / gulp-conventional-changelog.js
Created June 30, 2015 08:44
gulp-conventional-changelog
var gulp = require('gulp');
var conventionalChangelog = require('conventional-changelog');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var addsrc = require('gulp-add-src');
var concat = require('gulp-concat');
/**
* Creates a `changelog` task, that will process all commits from the latest tag
* and generates a CHANGELOG.md file by appending the old contents to it.
@frapontillo
frapontillo / pipeline
Last active August 29, 2015 14:22
crowd-pulse pipeline
+-----------------+
| |
| Observable<A> |
| |
+--------+--------+
|
|
+--------v--------+
| |
| Observable<A> |
@frapontillo
frapontillo / CustomRecyclerViewAdapter.java
Last active August 31, 2019 13:28
How to use SwitchCompat inside a RecyclerView item
// omissis
@Override
public void onBindViewHolder(final CustomViewHolder holder, final int position) {
holder.mSwitch.setOnCheckedChangeListener(
new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, final boolean isChecked) {
// TODO: handle your switch toggling logic here
}
@frapontillo
frapontillo / video-for-web.sh
Last active August 29, 2015 14:17
Convert videos for the Web (H264/VP8)
#!/bin/sh
mp4="-threads 16 -strict -2 -c:v libx264 -c:a aac -f mp4"
webm="-threads 16 -map 0 -c:v libvpx -qmin 0 -qmax 50 -crf 5 -b:v 5M -c:a libvorbis -c:s webvtt -f webm"
ffmpeg -i $1 \
$mp4 -vf scale=-2:1080 $2-1080.mp4 \
$webm -vf scale=-2:1080 $2-1080.webm \
$mp4 -vf scale=-2:720 $2-720.mp4 \
$webm -vf scale=-2:720 $2-720.webm \
@frapontillo
frapontillo / make-gif.sh
Created March 18, 2015 22:31
Make (good) GIFs w/ ffmpeg
#!/bin/sh
# originally from http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html
palette="palette.png"
filters="fps=15,scale=320:-1:flags=lanczos"
ffmpeg -v warning -i $1 -vf "$filters,palettegen" -y $palette
ffmpeg -v warning -i $1 -i $palette -lavfi "$filters [x]; [x][1:v] paletteuse" -y $2
rm $palette
@frapontillo
frapontillo / mongodb-install.bat
Created December 4, 2014 22:28
MongoDB Batches for Windows
mkdir %~dp0data\db
mkdir %~dp0log
echo logpath=%~dp0log\mongo.log >> "%~dp0mongod.cfg"
echo dbpath=C:\mongodb\data\db >> "%~dp0mongod.cfg"
sc.exe create MongoDB binPath= "\"%~dp0bin\mongod.exe\" --service --config=\"%~dp0mongod.cfg\"" DisplayName= "MongoDB" start= "auto"
net start MongoDB
pause