Skip to content

Instantly share code, notes, and snippets.

View axilleas's full-sized avatar
🏠
Working from home

Achilleas Pipinellis axilleas

🏠
Working from home
View GitHub Profile
@axilleas
axilleas / cron_helper.sh
Last active October 26, 2017 00:37 — forked from liquidgecka/cron_helper.sh
Cron helper
#!/bin/bash
usage() {
cat << EOF
Usage: $0 [OPTION]... COMMAND
Execute the given command in a way that works safely with cron. This should
typically be used inside of a cron job definition like so:
* * * * * $(which "$0") [OPTION]... COMMAND
Arguments:
user www-data;
worker_processes 4; # number of cores on machine
error_log /var/log/nginx/error.log;
events {
worker_connections 1024;
}
http {
@axilleas
axilleas / mediawiki-nginx.conf
Last active August 29, 2015 14:24
Nginx config for mediawiki hosted under wordpress
#
# nginx configuration for virtual host: axilleas.me.
#
# http -> https redirection
server {
listen 80;
listen [::]:80;
# virtual host domains

Vagrant & NFS for systemd users

Create group vagrant and add your user to the vagrant group:

groupadd vagrant
usermod -aG vagrant user

Drop these lines in a new file /etc/sudoers.d/vagrant

echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/v0.10.37/node-v0.10.37-linux-x86.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.com/install.sh | sh
BEFORE:
sam@ubuntu discourse % rm -fr tmp/cache
sam@ubuntu discourse % rm -fr public/assets
sam@ubuntu discourse % time RAILS_ENV=production bin/rake assets:precompile
58.55s user 1.79s system 100% cpu 1:00.02 total
AFTER:
#!/usr/bin/php -qC
<?php
/******************************************************************************
*
* @file gitolab.php
* @author Benoit Zohar
* @link http://benoitzohar.fr/
* @last-edited 2015-01-09
* @description Migrate projects from Gitolite to GitLab
@axilleas
axilleas / diaspora.tmpfiles.d
Last active August 29, 2015 14:12
Diaspora systemd services for unicorn and sidekiq
d /run/diaspora 0755 diaspora diaspora -
@axilleas
axilleas / sidekiq.md
Last active August 29, 2015 14:10
diaspora sidekiq failures
Federated::Relayable#parent_author delegated to parent.author, but parent is nil: #

lib/diaspora/relayable.rb:24:in `rescue in parent_author' 
lib/diaspora/relayable.rb:21:in `parent_author'
lib/postzord/receiver/public.rb:73:in `xml_author'
lib/postzord/receiver.rb:16:in `author_does_not_match_xml_author?'
lib/postzord/receiver/public.rb:60:in `save_object'
lib/postzord/receiver/public.rb:26:in `receive!'
lib/postzord/receiver.rb:12:in `perform!'
@axilleas
axilleas / index.php
Created October 14, 2014 17:11
maellak php
<html>
<body>
<form action="movies.php" method="post">
<p>Pick Category
<select name="catMovie">
<option value="">Select...</option>
<option value="comedy">Comedy</option>
<option value="drama">Drama</option>
<option value="horror">Horror</option>