Skip to content

Instantly share code, notes, and snippets.

View badpenguin's full-sized avatar
🏠
Working from home

Antonio Gallo badpenguin

🏠
Working from home
View GitHub Profile
@badpenguin
badpenguin / ffmpeg-adaptive-hls.sh
Created May 7, 2024 15:32
This portion of script downscale your video to 4 video formats and create all the HLS playlist. Then you can host the files on your servers and use VideoJS, Shaka and others as a player.
OPT="-c:a aac -ar 48000 -c:v libx264 -profile:v main -preset veryfast -tune fastdecode -crf 21 -sc_threshold 0 -g 48 -keyint_min 48 -hls_time 6 -hls_playlist_type vod -hls_flags independent_segments -hls_segment_type mpegts -hls_list_size 0"
ffmpeg \
-hide_banner -loglevel warning -stats \
-threads 8 -hwaccel vdpau \
-y -i "$IFILE" \
$OPT \
-map 0:v:0 -map 0:a:0 -map 0:v:0 -map 0:a:0 -map 0:v:0 -map 0:a:0 -map 0:v:0 -map 0:a:0 \
-filter:v:0 scale=w=640:h=360:force_original_aspect_ratio=decrease:force_divisible_by=2 -b:v:0 800k -maxrate:v:0 856k -bufsize:v:0 1200k -b:a:0 96k \
-filter:v:1 scale=w=842:h=480:force_original_aspect_ratio=decrease:force_divisible_by=2 -b:v:1 1400k -maxrate:v:1 1498k -bufsize:v:1 2100k -b:a:1 128k \
@badpenguin
badpenguin / ionItemAccordion-directive.js
Created September 23, 2016 09:38
Ionic 1 accordion expanding ion-list
/*
* This is my accordion for Ionic 1 please visit http://www.antoniogallo.it/
*/
angular.module('rootApp').directive('ionItemAccordion', function($log, $ionicScrollDelegate,$ionicPosition, $timeout) {
return {
restrict: 'E',
replace: true,
transclude: true,
require: '^ionList',
@badpenguin
badpenguin / build.gradle
Last active February 6, 2019 19:11
snippets of android/build.gradle used to fix compilation problems with outdated subprojects in React Native 0.58.3
subprojects {
afterEvaluate {project ->
if (project.hasProperty("android") && VersionNumber.parse(project.property("android").buildToolsVersion) < VersionNumber.parse("28.0.2")) {
def oldver = VersionNumber.parse(project.property("android").buildToolsVersion)
println ""
println "(*) UPGRADING $project.name from $oldver ..."
println ""
android {
compileSdkVersion 28
@badpenguin
badpenguin / nginx-wordpress.inc
Created July 7, 2018 18:59
Allow access to Wordpress only if user has passed thru another page first and gathered a special cookie
set $cicciopasticcio 0;
if ($request_uri ~* "/wp-admin|/wp-login.php") {
set $cicciopasticcio 1;
}
if ($request_uri ~* "/wp-admin/admin-ajax.php") {
set $cicciopasticcio 0;
}
if ($cookie_cicciopasticcio != "nginx") {
set $cicciopasticcio "${cicciopasticcio}1";
}
@badpenguin
badpenguin / gradle.properties
Last active February 20, 2018 18:17 — forked from BilalBudhani/gradle.properties
Create this file in ~/.gradle folder to speed up React Native Android building process.
org.gradle.parallel=true
org.gradle.daemon=true
org.gradle.jvmargs=-Xms512m -Xmx1024m
@badpenguin
badpenguin / $log.ts
Created February 14, 2018 11:18
simple replacement for angular1 $log service - include an rxjs observable debugger and some helper for android's web apps
/*
* Antonio Gallo - https://www.antoniogallo.it - http://www.badpenguin.org/
* simple replacement for angular1 $log service
*/
// makes TS compiler happy
import {jStringify} from "./helpers";
import {Observable} from "rxjs";
declare let console: any;
" CORE
set nocompatible
set enc=utf-8
" GUI
syntax on
colorscheme pablo
" Formatting / Indent
#!/usr/bin/env bash
# Space/Tab separated list of cryptocurrencies to query
CRYPTO="BTC ETH ZEC PPC"
# Fiat separated by comma
#FIAT="EUR,USD"
#FIAT="USD"
FIAT="EUR"
@badpenguin
badpenguin / Ionic2 Preloader Example index.html
Last active February 25, 2017 20:49
Ionic2 Preloader Example
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="UTF-8">
<title>Ionic App</title>
<meta name="viewport"
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="format-detection" content="telephone=no">
<meta name="msapplication-tap-highlight" content="no">
@badpenguin
badpenguin / flexbox minimal grid
Created February 16, 2017 09:00
This is a Work in progress of a minimal flexbox grid
// https://css-tricks.com/snippets/css/a-guide-to-flexbox/
.flexbox-container-block {
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
}