Skip to content

Instantly share code, notes, and snippets.

View fake-or-dead's full-sized avatar

fake-or-dead fake-or-dead

  • Thailand
  • 21:41 (UTC +07:00)
View GitHub Profile
@1hakr
1hakr / example.com
Last active November 29, 2024 20:48
Supercharge your NGIX config
proxy_cache_path /tmp/cacheapi levels=1:2 keys_zone=microcacheapi:100m max_size=1g inactive=1d use_temp_path=off;
server {
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
server_name example.com;
location /api/ {
# Rate Limiting
limit_req zone=reqlimit burst=20; # Max burst of request

Kind of continue from the other gist how to install LAMP on an Amazon AMI

##Install git

sudo yum install git-core

##Create ssh directory since it doesn't exists by default on the Amazon AMI

@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@apirak
apirak / meta_currency.rb
Created March 23, 2012 15:02
Meta programming example with currency expert
currency = {usd: 1, baht: 30.73, yen: 83.447, rupee: 50.21}
[Float, Fixnum].each do |number|
currency.each do |key, value|
number.class_eval "def #{key};
return self/#{value};
end"
number.class_eval %{def #{key}_string;
return (self * #{value}).to_s+" #{key.upcase}";
end}
@apirak
apirak / hangman.rb
Created March 23, 2012 14:51
Hangman game with class, yield and self
require_relative 'hangman_class_3'
hangman = Hangman.new
hangman.start do |h|
puts h.answer
print "#{h.limit} Enter your best guest: "
h.guess(gets)
end
@apirak
apirak / hangman.rb
Created March 23, 2012 14:42
Hangman game with simple class
require_relative 'hangman_class'
hangman = Hangman.new
hangman.start
until hangman.finish
puts hangman.answer
print "#{hangman.limit} Enter your best guess: "
hangman.guess(gets)
@apirak
apirak / Hangman.rb
Created March 23, 2012 14:38
Hangman games with out class
@words = %w{spiderman superman powerpuf hangman}
@finish = false
@limit = 8
@win = false
@word = @words[rand(@words.length-1)]
@answer = "_" * @word.length
def guest(answer)
@limit -= 1
@jonathonbyrdziak
jonathonbyrdziak / ExampleUsage.php
Created March 15, 2012 18:43
A Wordpress class that allows you to place watermarks on your images.
<?php
/**
* The constants defined here are used as a fallback to whatever options you
* end up specifying specifically.
*
* @var constant string
*/
define('WATERMARK_SOURCE', ABSPATH.'/wp-content/themes/mytheme/images/fb_thumb_watermark.png');
define('WATERMARK_ORIENTATION', 'bottom right');
@atroche
atroche / gist:1322143
Created October 28, 2011 12:19
Facebook Beautified
if (!window.FB) window.FB = {
_apiKey: null,
_session: null,
_userStatus: "unknown",
_logging: true,
_inCanvas: window.location.search.indexOf("fb_sig_in_iframe=1") > -1 || window.location.search.indexOf("session=") > -1 || window.location.search.indexOf("signed_request=") > -1 || window.name.indexOf("iframe_canvas") > -1 || window.name.indexOf("app_runner") > -1,
_https: window.name.indexOf("_fb_https") > -1,
_domain: {
api: "https://api.facebook.com/",
api_read: "https://api-read.facebook.com/",
@aronwoost
aronwoost / README.md
Created July 25, 2011 19:48
Build auto-deploy with php and git(hub) on an EC2 Amazon AMI instance

Kind of continue from the other gist how to install LAMP on an Amazon AMI

##Install git

sudo yum install git-core

##Create ssh directory since it doesn't exists by default on the Amazon AMI