Skip to content

Instantly share code, notes, and snippets.

Avatar

Fotis Evangelou fevangelou

View GitHub Profile
@fevangelou
fevangelou / timezone.php
Created Apr 9, 2016 — forked from Xeoncross/timezone.php
The perfect TimeZone selectbox list for PHP 5.3+
View timezone.php
<?php
$regions = array(
'Africa' => DateTimeZone::AFRICA,
'America' => DateTimeZone::AMERICA,
'Antarctica' => DateTimeZone::ANTARCTICA,
'Aisa' => DateTimeZone::ASIA,
'Atlantic' => DateTimeZone::ATLANTIC,
'Europe' => DateTimeZone::EUROPE,
'Indian' => DateTimeZone::INDIAN,
'Pacific' => DateTimeZone::PACIFIC
@fevangelou
fevangelou / mysql-convert-charset.sh
Created Mar 31, 2016 — forked from samuelpismel/mysql-convert-charset.sh
Shell script to change and convert mysql databases charset and collate.
View mysql-convert-charset.sh
#!/bin/bash
database='database'
user='user'
pass='pass'
charset='utf8mb4'
collate='utf8mb4_unicode_ci'
echo "Changing charset of database: $database"
@fevangelou
fevangelou / random-id.js
Created Feb 16, 2016 — forked from alexey-bass/random-id.js
Generate read-error-free hash. Similar letters absent (like 0 and O).
View random-id.js
function randomString(length, chars) {
var result = '';
for (var i = length; i > 0; --i) {
result += chars[Math.round(Math.random() * (chars.length - 1))];
}
return result;
}
var dictionary = '';
dictionary+= 'ABCDEFGHKLMNPQRTWXYZ'; // IJOSUV
@fevangelou
fevangelou / timestamp.js
Created Jan 17, 2016 — forked from hurjas/timestamp.js
Print out a nicely formatted timestamp in JavaScript.
View timestamp.js
/**
* Return a timestamp with the format "m/d/yy h:MM:ss TT"
* @type {Date}
*/
function timeStamp() {
// Create a date object with the current time
var now = new Date();
// Create an array with the current month, day and time
@fevangelou
fevangelou / functions.php
Created Dec 30, 2015 — forked from kricore/functions.php
Greeklish permalinks for Wordpres - NOT MINE
View functions.php
<?php
// Paste this function in your theme's function.php file
function greeklish_permalinks_sanitize_title($text) {
if ( !is_admin() ) return $text;
$expressions = array(
'/[αΑ][ιίΙΊ]/u' => 'e',
'/[οΟΕε][ιίΙΊ]/u' => 'i',
'/[αΑ][υύΥΎ]([θΘκΚξΞπΠσςΣτTφΡχΧψΨ]|\s|$)/u' => 'af$1',
@fevangelou
fevangelou / sysctl.conf
Created Dec 22, 2015 — forked from sokratisg/sysctl.conf
Tuned sysctl.conf for use by CentOS/RHEL 6.x or later
View sysctl.conf
# Kernel sysctl configuration file for Red Hat Linux
#
# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and
# sysctl.conf(5) for more details.
# Turn on execshield
# 0 completely disables ExecShield and Address Space Layout Randomization
# 1 enables them ONLY if the application bits for these protections are set to “enable”
# 2 enables them by default, except if the application bits are set to “disable”
# 3 enables them always, whatever the application bits
@fevangelou
fevangelou / gist:beea28dcf76e2d47dd98
Created Dec 19, 2015 — forked from jgornick/gist:0b10798608193ba4fd6d
Nginx: Advanced proxy_pass depending on file exists
View gist:beea28dcf76e2d47dd98
server {
listen 443;
server_name my.domain.com;
root /var/www/my.domain.com;
ssl on;
ssl_certificate /usr/local/etc/ssl/star.crt;
ssl_certificate_key /usr/local/etc/ssl/star.key;
@fevangelou
fevangelou / gist:249ad9ae9e659e84d1ae
Created Nov 14, 2015 — forked from jedi4ever/gist:903751
Tuning stuff for Ubuntu hosts
View gist:249ad9ae9e659e84d1ae
# /etc/security/limits.conf
* soft nofile 999999
* hard nofile 999999
root soft nofile 999999
root hard nofile 999999
===========================================================
# /etc/sysctl.conf
# sysctl for maximum tuning
@fevangelou
fevangelou / sendmail.conf
Last active Nov 8, 2015 — forked from adamstac/gist:7462202
Install and configure Sendmail on Ubuntu
View sendmail.conf
# Install and configure Sendmail on Ubuntu
This should help you get Sendmail installed with basic configuration on Ubuntu.
1. If sendmail isn't installed, install it: `sudo apt-get install sendmail`
2. Configure `/etc/hosts` file: `nano /etc/hosts`
3. Make sure the line looks like this: `127.0.0.1 localhost yourhostname`
4. Run Sendmail's config and answer 'Y' to everything: `sudo sendmailconfig`
5. Restart apache `sudo service apache2 restart`
@fevangelou
fevangelou / notepad.html
Created Jun 13, 2014 — forked from jdkanani/notepad.html
This bookmarklet gives you a code editor in your browser with a single click
View notepad.html
data:text/html, <style type="text/css">.e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div class="e" id="editor"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("editor");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script>
<!--
For other language: Instead of `ace/mode/ruby`, Use
Markdown -> `ace/mode/markdown`
Python -> `ace/mode/python`
C/C++ -> `ace/mode/c_cpp`
Javscript -> `ace/mode/javascript`
Java -> `ace/mode/java`
Scala- -> `ace/mode/scala`