Skip to content

Instantly share code, notes, and snippets.

@donis
donis / remove-stale-branches.sh
Last active October 23, 2018 09:38
Remove stale remote branches not being touched for some time
#!/bin/bash
git pull -p
# remove merged branches
git push origin --delete $(git branch -r --merged development | egrep -v 'master|development|release-|/wisag|WIP-file-refactoring|batch_poc|codeception-playground|delete-network-script|docker-config|es-5.6|file-refactoring|jsonweb|modifier-visitor|proper-release-114|remove-dupdevices-cmd|worker_retry|feature4' | cut -d/ -f2-)
# remove old braches with
for k in $(git branch -r | egrep -v 'master|development|release-|/wisag|WIP-file-refactoring|batch_poc|codeception-playground|delete-network-script|docker-config|es-5.6|file-refactoring|jsonweb|modifier-visitor|proper-release-114|remove-dupdevices-cmd|worker_retry|feature4'); do
if [ "$(git log -1 --since='1 year ago' -s $k)" == "" ]; then
<?php
class Train
{
public function __construct(array $wagons)
{
$this->wagons = (function (Wagon ...$wagons) {
return $wagons;
})(...$wagons);
}
@donis
donis / nginx.conf
Last active April 19, 2016 20:16
Nginx configuration for streaming
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
@donis
donis / ffmpeg_cut_video
Last active July 31, 2023 13:49
Cut middle out from some video with ffmpeg
# First we cut the video in how many parts we want
# Step 1. cut the first part of the video and cut it to a separate file
ffmpeg.exe -ss 00:00:00.000 -t 00:02:18.00 -i recording-full.flv -c:v copy -c:a copy recording-full-part1.flv
# Step 2. cut the second part from original video
ffmpeg.exe -ss 00:03:47.000 -i recording-full.flv -c:v copy -c:a copy recording-full-part2.flv
# Step 3. create a file with your cut parts to concat into one video with these contents and name it whatever (i.e. videos.txt):
file 'C:\Path\To\recording-full-part1.flv'
@donis
donis / en_to_native_countries
Created April 2, 2015 16:28
English to native country names
country,native_name
Afghanistan,افغانستان
Albania,Shqipëria
Algeria,الجزائر
American Samoa,Amerika Sāmoa
Andorra,Andorra
Angola,Angola
Anguilla,Anguilla
Antigua and Barbuda,Antigua and Barbuda
Argentina,Argentina
@donis
donis / gist:4c8f48947a8f4b5e1d10
Created December 9, 2014 16:15
Dealing with double exception traces in PHP with Xdebug
Just set display_errors=Off in php.ini and you'll see trace only from Xdebug.