Skip to content

Instantly share code, notes, and snippets.

View fordnox's full-sized avatar
🍕
Eating pizza

Andrius Putna fordnox

🍕
Eating pizza
View GitHub Profile
@fordnox
fordnox / flac2mp3.sh
Created August 26, 2018 19:47
flac to mp3 converter
#!/bin/bash
for f in "$@"; do
echo "$f"
[[ "$f" != *.flac ]] && continue
album="$(metaflac --show-tag=album "$f" | sed 's/[^=]*=//')"
artist="$(metaflac --show-tag=artist "$f" | sed 's/[^=]*=//')"
date="$(metaflac --show-tag=date "$f" | sed 's/[^=]*=//')"
title="$(metaflac --show-tag=title "$f" | sed 's/[^=]*=//')"
year="$(metaflac --show-tag=date "$f" | sed 's/[^=]*=//')"
@fordnox
fordnox / check-ftp.php
Created April 5, 2017 13:17
Check ftp connection with PHP
<?php
$host = 'example.com';
$password = 'pass';
$username = 'username';
try {
$result = checkFtp($host, $username, $password);
} catch(Exception $e) {
$result = $e->getMessage();
}
@fordnox
fordnox / deploy.rb
Created March 21, 2017 13:32
universal mina deploy script
require 'mina/rsync'
set :user, ENV['USER'] || 'username'
set :domain, ENV['DOMAIN'] || 'foobar.com'
set :deploy_to, ENV['DEPLOY_PATH'] || '/tmp/deploy'
set :branch, ENV['GIT_BRANCH'] || 'master'
set :repository, ENV['GIT_REPO'] || '.'
set :rsync_options, %w[
--recursive --delete --delete-excluded
--exclude .git*
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCtoCHKm+G/ywvZvNkhXzUYXVLJGl6FYt+0dizFvcUNRsZmNZHjicBqOyAIRI4OSaACuMhaNJ9oakMLuZhdJxKETTZhRLmokRDgiTDBwItBLpM6NeLeFLpvj51vPllV6wqv6ybIb6sH3nuUkkeDrdkTOGB0uTXKKeU0ggzSWwUTEURQ6JdiQOgylmZ0WtK0PFjPykgDdikY/mGvKytgX2TizdMqbhF8YNuViRpV398QB+FFPkspm2jSpRAs7uEg53I14L1jde6NEJJMraIHSK5EnqFpJRRD+zc8VZ2+8jGtV6onQ9s+9kqPes7JyshkZwcndlT5539WJZ/Js1SHaH6Z fordnox
@fordnox
fordnox / plugin-enabler.sh
Created December 15, 2016 14:58
Enable cache plugin for wordpress
#install wp-cli on server https://github.com/wp-cli/wp-cli
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp
#install cache plugin to wordpress
curl -O https://raw.githubusercontent.com/bluehost/endurance-page-cache/master/endurance-page-cache.php
#activate plugin
var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs")
port = process.argv[2] || 8888;
http.createServer(function(request, response) {
var uri = url.parse(request.url).pathname
, filename = path.join(process.cwd(), uri);
@fordnox
fordnox / RabbitRpc.php
Created June 9, 2015 13:05
RabbitRpc.php
<?php
use PhpAmqpLib\Connection\AMQPConnection;
use PhpAmqpLib\Message\AMQPMessage;
class RabbitRpc
{
const TIMEOUT = 15;
@fordnox
fordnox / latest.html
Created February 27, 2015 09:08
Lastes version of software from github
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<div class="container">
<p>
<a href="#" class="release-download btnd btnd-1 btnd-1d">Download</a>
@fordnox
fordnox / fb_friends.py
Created February 25, 2015 20:46
Facebook friends pictures
import requests
import json
import urllib2
import webbrowser
from pprint import pprint
token = ''
api_url = 'https://graph.facebook.com/v2.1/'
params = {'access_token' : token}
@fordnox
fordnox / domain.conf
Created December 13, 2014 08:20
Split clients nginx conf
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
events {
worker_connections 1024;
}