Skip to content

Instantly share code, notes, and snippets.

View radutopala's full-sized avatar
🦅
Building in Go @trisoftro #golang

Radu Topala radutopala

🦅
Building in Go @trisoftro #golang
View GitHub Profile
@radutopala
radutopala / array_iterator.php
Created June 26, 2017 14:42
RecursiveArrayIterator example
<?php
$configs = [
'test' => [
'alfa' => 'beta'
],
'gamma' => 'first'
];
$iterator = new \RecursiveArrayIterator($configs);
@radutopala
radutopala / composer_gzip_test.php
Last active March 3, 2020 17:26
Composer GZIP decoding test
<?php
$retries = 0;
function fetch() {
global $retries;
echo "Retry " . $retries . " | ";
$opts = array(
@radutopala
radutopala / ApiExceptionListener.php
Last active April 12, 2016 09:55
Api Exception Listener
<?php
namespace TSS\CoreBundle\EventListener;
use Psr\Log\LoggerInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
@radutopala
radutopala / himawari.go
Created February 7, 2016 06:43 — forked from FZambia/himawari.go
Download Earth images from Himawari-8 satellite
// This script downloads Earth images from Himawari-8 satellite.
//
// After all images saved you can run this to generate video with ffmpeg:
//
// ffmpeg -framerate 20 -pattern_type glob -i '*.png' -c:v libx264 -pix_fmt yuv420p video.mp4
// ffmpeg -i video.mp4 -i Morning_Mood_by_Grieg.mp3 -vcodec copy -acodec copy -shortest audiovideo.mp4
// ffmpeg -i audiovideo.mp4 -vf pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2" output.mp4
//
// Most of code here from https://github.com/avinashbot/himawari
package main
@radutopala
radutopala / mover.go
Created June 7, 2015 18:37
Moving files with go
package main
import (
"fmt"
"io"
"os"
s "strings"
"github.com/kr/fs"
)
@radutopala
radutopala / vdom-diff.js
Last active August 29, 2015 14:17
virtual dom diff test
var parser = require('html2hscript'),
redis = require("redis"),
client = redis.createClient(),
util = require('util'),
diff = require('virtual-dom/diff'),
patches, content, oldTree = '';
client.on("error", function (err) {
console.log("Error " + err);
});
@radutopala
radutopala / ubuntu14.04php5.5.sh
Last active August 29, 2015 14:05
Ubuntu 14.04 with PHP5.5 without mysql-server on AWS
#!/bin/bash
echo ‘LC_ALL=en_US.UTF-8’ > /etc/environment
echo ‘LANG=en_US.UTF-8’ >> /etc/environment
apt-get update -y && sudo apt-get -y dist-upgrade
apt-get install -y curl
apt-get install -y apache2
apt-get install -y php5
apt-get install php5-cli
apt-get install -y git
@radutopala
radutopala / ubuntu1204php54.sh
Last active August 29, 2015 14:05
Ubuntu 12.04 with PHP5.4 without mysql-server on AWS
#!/bin/bash
echo ‘LC_ALL=en_US.UTF-8’ > /etc/environment
echo ‘LANG=en_US.UTF-8’ >> /etc/environment
apt-get install -y python-software-properties
add-apt-repository -y ppa:ondrej/php5-oldstable
apt-get update -y && apt-get -y upgrade && apt-get -y dist-upgrade
apt-get install -y php5
apt-get install php5-cli
apt-get install -y curl apache2 git php5-curl php5-intl
@radutopala
radutopala / gist:7370100
Created November 8, 2013 12:06
Symfony2 app - updating composer.lock file when "Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them." appears.
php -dmemory_limit=-1 /usr/bin/composer update --lock
@radutopala
radutopala / cleanup_git_svn.sh
Last active December 26, 2015 10:19
Clean svn dirs from a git repo
#!/bin/bash
find . -name .svn -print0 | xargs -0 rm -r
paths=`git ls-files --deleted`
for path in $paths
do
echo ${path} to be removed
git rm -r $path