Skip to content

Instantly share code, notes, and snippets.

View tunglam14's full-sized avatar

Lam Dang Tung tunglam14

View GitHub Profile
@tunglam14
tunglam14 / enable_rpaf_mod
Created January 26, 2013 02:38
enable rpaf mod apache 2
$ sudo apt-get install libapache2-mod-rpaf
$ sudo a2enmod rpaf
$ sudo service apache2 restart
cat /etc/apache2/sites-available/default
....
<IfModule rpaf_module>
RPAFenable On
RPAFsethostname On
RPAFproxy_ips 10.0.0.2
@tunglam14
tunglam14 / url.php
Created February 10, 2013 12:50
get download link from nhaccuatui - lamdt@familug.org
<?
// Get arg
$arguments = getopt("h::u:d::");
// For help
if(isset($arguments['h']) or empty($arguments))
{
$html = "Options: \n\r
-h: \t Help \n\r
-u: \t Nhaccuatui URL \n\r
--d: \t Enable download \n\r
@tunglam14
tunglam14 / emoticons
Created April 26, 2013 03:18
emoticons
$C->POST_ICONS = array (
':)' => 'icon_smile.gif',
':(' => 'icon_sad.gif',
';)' => 'icon_wink.gif',
':P' => 'icon_razz.gif',
':p' => 'icon_razz.gif',
':D' => 'icon_biggrin.gif',
':d' => 'icon_biggrin.gif',
';(' => 'icon_cry.gif',
'=))' => '24.gif',
def sqrt(n, i=1):
if n == i:
return n ** 0.5
else:
return (i + sqrt(n, i+1)) ** 0.5
php5-cli: # without apache2
pkg:
- installed
php5-fpm:
pkg:
- installed
- required:
- pkg: php5-cli
photoid 792000 - OK
photoid 792001 - OK
photoid 792002 - OK
photoid 792003 - OK
photoid 792004 - OK
photoid 792005 - OK
photoid 792006 - OK
photoid 792007 - OK
photoid 792008 - OK
photoid 792009 - OK
@tunglam14
tunglam14 / fix_gpg_key_erro.sh
Created August 1, 2013 03:03
W: GPG error: http://domain.com unstable Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5
sudo apt-key adv –keyserver pgp.mit.edu –recv-keys 40976EAF437D05B5
# or
gpg --keyserver subkeys.pgp.net --recv-keys 40976EAF437D05B5
gpg --armor --export 40976EAF437D05B5 | sudo apt-key add -
# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout somewhen, delete
# this file and re-run i3-config-wizard(1).
#
# i3 config file (v4)
#
# Please see http://i3wm.org/docs/userguide.html for a complete reference!
start on runlevel [2345]
stop on runlevel [!2345]
chdir /usr/local/app_name
setuid ubuntu
setgid ubuntu
post-start script
exec bundle exec unicorn_rails -c config/unicorn.rb -D -E production
upstream app_name {
server unix:/usr/local/app_name/tmp/sockets/unicorn.sock;
}
server {
listen 80;
server_name localhost;
root /usr/local/app_name/public;
server_tokens off;