Skip to content

Instantly share code, notes, and snippets.

View Strae's full-sized avatar
🎯
Focusing

Daniele P. Strae

🎯
Focusing
View GitHub Profile
@Strae
Strae / terminator-random-profile.sh
Created May 5, 2017 09:59
Terminator random profile
#!/bin/bash
# Profiles must be named profile1, profile2, etc..
N=$(( ( RANDOM % 12 ) + 1 ));
terminator -p profile$N -T $N &
@Strae
Strae / xfdf.php
Created January 20, 2017 10:18 — forked from collegeman/xfdf.php
Generate xFDF in PHP
<?php
/*
KOIVI HTML Form to FDF Parser for PHP (C) 2004 Justin Koivisto
Version 1.1
Last Modified: 2010-02-17
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
@Strae
Strae / moodle.conf
Created December 15, 2016 09:01
Moodle 3.1 Nginx configuration
server {
listen 80;
server_name [SERVERNAME];
root [HTROOT-PATH];
index index.php index.html index.htm;
location / {
# First attempt to serve request as file
try_files $uri $uri/index.php;
}
@Strae
Strae / menu.sql
Created August 26, 2016 10:24
Wordpress menu sql
SELECT
p.ID,
m.meta_value,
md.post_author,
wp_users.user_nicename,
p.post_parent,
p.menu_order,
md.post_title
FROM
wp_posts AS p
@Strae
Strae / zang.sh
Created June 28, 2016 08:09
Cloudatcost CloudPro resize hard disk (Debian)
lastpart=`fdisk -l /dev/sda | grep sda |tail -1 |awk '{ print $1 }' |grep -o "[0-9]"`
newpart=`expr $lastpart + 1`
startsec=`parted /dev/sda unit s print free |tail -2 |grep Free |awk '{ print $1 }'`
endsec=`parted /dev/sda unit s print free |tail -2 |grep Free |awk '{ print $2 }'`
parted /dev/sda mkpart primary ext2 $startsec $endsec
parted /dev/sda set $newpart lvm on
partx -v -a /dev/sda
pvcreate /dev/sda$newpart
vgname=`vgdisplay |grep "VG Name" |awk '{ print $3 }'`
vgextend $vgname /dev/sda$newpart
@Strae
Strae / watch.sql
Created May 30, 2016 16:44
Watch mkysql select query
watch -n .1 "echo 'QUERY_STATEMENT' | mysql -u DBUSER -pDBPASS DBNAME"
@Strae
Strae / nginx.conf
Last active May 16, 2016 10:46
Defualt debian 8 ngunx.conf (clean after-install)
user www-data;
worker_processes 4;
pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
@Strae
Strae / debugger.js
Last active May 13, 2016 10:09
Js debug utilities
// This small function is somewhere in my code, only purpose is to keep the snippet as small as possible
// Return the line number from a new Error().stack element.
function _dl(s){
return "\n\t=>\t[" + s.toString()
.split(/\r\n|\n/)[1] // get the line
.split(/(.*)\((.*)\)(0*)/)[2] // filepath, line number
+ ']';
}
// ..becose chrome console sometimes jerks with line numbers.
@Strae
Strae / TEMPLATE.conf
Created April 27, 2016 11:58
PHP5 FPM simpliest pool config
[POOL]
listen = /var/run/php5.POOL.sock
listen.owner = www-data
listen.group = www-data
user = USER
group = USER
pm = dynamic
pm.max_children = 5
@Strae
Strae / conkybars.lua
Created April 16, 2016 22:51
Conky bars configuration
--[[
conky vertical bar graph
by iggykoopa mods by arpinux(2009)
most of the credit goes to londonali1010, I stole big chunks from her ring graphs
]]
require 'cairo'