Skip to content

Instantly share code, notes, and snippets.

View GiovanniGrieco's full-sized avatar
💭
mumble mumble

Giovanni Grieco GiovanniGrieco

💭
mumble mumble
View GitHub Profile
@GiovanniGrieco
GiovanniGrieco / cleanup.sh
Created April 6, 2017 20:38
TODO things for Fedora at post-install
sudo dnf remove libreoffice* rhythmbox evolution gnome-calculator gnome-calendar cheese gnome-clocks gnome-contacts gnome-maps gnome-weather
sudo dnf update
sudo dnf install binutils gcc gcc-c++ patch bison cmake flex python perl-ExtUtils-MakeMaker perl-Thread-Queue vim
sudo reboot
@GiovanniGrieco
GiovanniGrieco / Preferences.sublime-settings
Last active November 26, 2016 11:06
Personal settings for Sublime Text 3
{
"always_show_minimap_viewport": true,
"bold_folder_labels": true,
"caret_style": "phase",
"color_scheme": "Packages/Material Theme/schemes/Material-Theme.tmTheme",
"detect_intendation": false,
"font_face": "Roboto Mono",
"font_size": 12,
"highlight_line": true,
"ignored_packages":
@GiovanniGrieco
GiovanniGrieco / Imagine_Saviano2015.sh
Last active January 24, 2016 14:24
ITALIAN - Questo script scarica la puntata "Imagine - Saviano racconta il 2015", mandata in onda a dicembre 2015. Non sfrutta alcuna hack, infatti utilizza il metodo di streaming di brightcove e salva lo stream in locale.
#!/bin/sh
printf "Downloading metadata...\n"
url=$(curl -s "http://c.brightcove.com/services/mobile/streaming/index/master.m3u8?videoId=4677882746001" | grep http | tail -1)
i=0
curl -s "$url" | grep http > TSList.m3u8
cat TSList.m3u8 | while read -r line; do
printf -v out "fragment_%05d.ts" $i
printf "Downloading fragment %d / 494\r" $i
curl -s "$line" -o $out
i=$((i+1))
@GiovanniGrieco
GiovanniGrieco / getTerminalCols
Last active August 29, 2015 14:12
Get terminal width - Cross-platform
<?php
function getTerminalCols()
{
$cols = 0;
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
$cmdHandler = popen('more', 'r');
$cmdInfo = fread($cmdHandler, 2096);
pclose($cmdHandler);
$cmdInfo = explode("\n", $cmdInfo);
$cols = trim(substr($cmdInfo[9], -4, 4));
<?php
define("TIMEINTERVAL", 60); // define the interval in seconds
//we have a session, so I call it
session_start();
// if the user have not visited a page under an interval of 60 seconds, destroy the session
if ( (time() - $_COOKIE['session_time']) > TIMEINTERVAL ) {
@GiovanniGrieco
GiovanniGrieco / decompress_gzip_stream
Created June 16, 2013 15:42
Decompress a gzip stream that was pushed to a webserver
$x = file_get_contents("compress.zlib://php://input");