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
Verifying that +putna is my Bitcoin username. You can send me #bitcoin here: https://onename.io/putna
@fordnox
fordnox / date_range.php
Created November 13, 2014 11:08
Date ranges in PHP
<?php
private function _getDataRange($range)
{
$lowerdate = null;
$upperdate = null;
switch ($range) {
case 'today':
$lowerdate = date('Y-m-d 00:00:00');
@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;
}
@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 / 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 / RabbitRpc.php
Created June 9, 2015 13:05
RabbitRpc.php
<?php
use PhpAmqpLib\Connection\AMQPConnection;
use PhpAmqpLib\Message\AMQPMessage;
class RabbitRpc
{
const TIMEOUT = 15;
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 / 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
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCtoCHKm+G/ywvZvNkhXzUYXVLJGl6FYt+0dizFvcUNRsZmNZHjicBqOyAIRI4OSaACuMhaNJ9oakMLuZhdJxKETTZhRLmokRDgiTDBwItBLpM6NeLeFLpvj51vPllV6wqv6ybIb6sH3nuUkkeDrdkTOGB0uTXKKeU0ggzSWwUTEURQ6JdiQOgylmZ0WtK0PFjPykgDdikY/mGvKytgX2TizdMqbhF8YNuViRpV398QB+FFPkspm2jSpRAs7uEg53I14L1jde6NEJJMraIHSK5EnqFpJRRD+zc8VZ2+8jGtV6onQ9s+9kqPes7JyshkZwcndlT5539WJZ/Js1SHaH6Z fordnox
@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*