Skip to content

Instantly share code, notes, and snippets.

@ZiTAL
ZiTAL / curl_time.sh
Created Mar 18, 2019
curl: get response time
View curl_time.sh
#!/bin/bash
# based on:
# https://stackoverflow.com/a/47944496/454827
# https://stackoverflow.com/a/49502232/454827
#curl --silent --output /dev/null -w "
#namelookup: %{time_namelookup}s\n\
#connect: %{time_connect}s\n\
#appconnect: %{time_appconnect}s\n\
@ZiTAL
ZiTAL / date-sync.py
Created Jan 18, 2019
python: erlojua interneteko web orri batekin zinkronizatzeko script-a
View date-sync.py
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import pycurl
from io import BytesIO
import re
from subprocess import Popen, PIPE
url = 'https://www.timeanddate.com'
@ZiTAL
ZiTAL / korrika.html
Created Jan 11, 2019
html: korrika bilatzailea 2019
View korrika.html
<!DOCTYPE html><html lang="en">
<head>
<meta charset="utf-8">
<title>Korrika 2019</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<div class="korrika_form">
<form onsubmit="return false;" class="pure-form" style="margin:30px 0 40px">
<input class="korrika_bilatzailea" autofocus type="text" name="q" placeholder="Herriaren izena..." style="width:100%;max-width:600px;outline:0">
@ZiTAL
ZiTAL / ffmpeg.sh
Created Jan 10, 2019
ffmpeg: video to gif
View ffmpeg.sh
#!/bin/bash
ffmpeg -i input.mp4 -vf fps=10,scale=320:-1:flags=lanczos,palettegen palette.png
ffmpeg -i input.mp4 -i palette.png -filter_complex "fps=10,scale=320:-1:flags=lanczos[x];[x][1:v]paletteuse" output.gif
@ZiTAL
ZiTAL / ffmpeg.sh
Created Jan 8, 2019
ffmpeg: create video from image and audio
View ffmpeg.sh
#!/bin/bash
ffmpeg -i audio.opus -f image2 -loop 1 -i logo.png -s 640x360 -r 30 -shortest output.mp4
@ZiTAL
ZiTAL / instructions.md
Last active Jan 4, 2019
php: compile php-fpm for nginx
View instructions.md
cd /usr/src
wget http://au1.php.net/get/php-7.2.13.tar.gz/from/this/mirror
mv mirror php-7.2.13.tar.gz
tar -xvzf php-7.2.13.tar.gz
cd php-7.2.13
mkdir -p /opt/php/php-7.2.13

nano configure.sh

@ZiTAL
ZiTAL / gist:0e052827aeda9f0028fcedb79bafa0e5
Created Dec 11, 2018
bash: order files by modification date in folder recursively
View gist:0e052827aeda9f0028fcedb79bafa0e5
#!/bin/bash
find $1 -type f -exec stat --format '%Y :%y %n' "{}" \; | sort -nr | cut -d: -f2-
@ZiTAL
ZiTAL / pulse.sh
Created Nov 23, 2018
ffmpeg: record desktop + pulseaudio
View pulse.sh
#!/bin/bash
ffmpeg -f pulse -ac 2 -i 0 -f x11grab -s 1280x800 -i :0.0 sample.mpg
@ZiTAL
ZiTAL / memcached-cli.php
Created Nov 15, 2018
php: memcached clie get example
View memcached-cli.php
<?php
// erabilera:
// php memcached-cli.php --host 127.0.0.1 --port 11211 --get 304b2b4e8c1639f858a6326d35aa88e4
$params = getCliParams();
$i = new Memcached();
$i->addServer($params['host'], $params['port']);
$i->setOption(Memcached::OPT_BINARY_PROTOCOL, true);
if(isset($params['get']))
{
@ZiTAL
ZiTAL / json.pl
Last active Nov 7, 2018
perl: read and dump json
View json.pl
# apt-get install libjson-perl
use strict;
use warnings;
use JSON;
use Data::Dumper;
my $filename = 'z.json';
my $content;
open(my $fh, '<', $filename) or die "cannot open file $filename";
You can’t perform that action at this time.