Skip to content

Instantly share code, notes, and snippets.

View keizie's full-sized avatar

Jeong-Hee Kang keizie

View GitHub Profile
@edtoon
edtoon / gist:6358598
Last active December 21, 2015 20:00
example mod_vhost_dbd / wildcard hosting server
#########################
# install binary stuffs #
#########################
apt-get install apache2 apache2-prefork-dev libaprutil1-dbd-mysql unzip mysql-server
mkdir -p /usr/local/src/mod_vhost_dbd
cd /usr/local/src/mod_vhost_dbd
wget http://dbd-modules.googlecode.com/files/dbd-modules-1.0.6.zip
unzip dbd-modules-1.0.6.zip
apxs2 -c mod_vhost_dbd.c

Generators vs Fibers

Both ES6 generators and node-fibers can be used to block a coroutine while waiting on some I/O without blocking the entire process. Both can do this for arbitrarily deep call stacks. The main difference between the capabilities of the two is how explicit the syntax is.

Generators - Safe, but Explicit

In code that uses ES6 generators:

var run = require('gen-run'); // https://github.com/creationix/gen-run
section36:[~/aatemp]$ xattr -px com.apple.metadata:kMDItemWhereFroms ~/Desktop/Porkins.jpg | xxd -p -r | plutil -convert xml1 -o - -
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<string>http://images3.wikia.nocookie.net/__cb20111104223727/starwars/images/5/53/Porkins.jpg</string>
<string></string>
</array>
</plist>
@meglio
meglio / Lazy.php
Last active November 24, 2015 02:02
<?php
/**
* Trait Lazy
*
* Allows for static and dynamic lazy initialization.
* NB. Include "use Lazy;" in every class you want this functionality, otherwise collision may happen if any of parents use Lazy.
*
* Example:
@FrostyX
FrostyX / FacebookDebugger.php
Last active December 11, 2024 20:33
Facebook API - Force facebook to reload cache from your website
<?php
class FacebookDebugger
{
/*
* https://developers.facebook.com/docs/opengraph/using-objects
*
* Updating Objects
*
* When an action is published, or a Like button pointing to the object clicked,
* Facebook will 'scrape' the HTML page of the object and read the meta tags.
@oliverdoetsch
oliverdoetsch / AND_OR_NOT
Last active January 22, 2023 17:03
Blogger: Globally conditional data tags for all page types
#AND
<b:if cond='data:blog.pageType == "index"'>
<b:if cond='data:blog.searchQuery'>
<!--search_page AND index_page-->
</b:if>
</b:if>
#OR
@mageekguy
mageekguy / gist:29cdf2e52d1c507f25b3
Last active October 24, 2015 22:33
Mysqli and generator are in a boat...
<?php
namespace db;
class client
{
private
$user,
$password,
$host,
@williamn
williamn / upstreams.conf
Last active July 7, 2022 03:05
CodeIgniter on nginx using PHP FPM
upstream php5438 {
server 127.0.0.1:5438;
}
@PurpleBooth
PurpleBooth / README-Template.md
Last active January 10, 2026 20:34
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@shreyaskarnik
shreyaskarnik / Instructions.md
Last active March 24, 2023 15:35
Route Docker Logs to ELK Stack
  • With Docker 1.8.0 shipped new log-driver for GELF via UDP, this means that the logs from Docker Container(s) can be shipped directly to the ELK stack for further analysis.
  • This tutorial will illustrate how to use the GELF log-driver with Docker engine.
  • Step 1: Setup ELK Stack:
    • docker run -d --name es elasticsearch
    • docker run -d --name logstash --link es:elasticsearch logstash -v /tmp/logstash.conf:/config-dir/logstash.conf logstash logstash -f /config-dir/logstash.conf
    • Note the config for Logstash can be found at this link
    • docker run --link es:elasticsearch -d kibana
  • Once the ELK stack is up now let's fire up our nginx container which ships its logs to ELK stack.
  • LOGSTASH_ADDRESS=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' logstash)
  • `docker run -d --net=host --log-driver=gelf --log-opt gelf-address=u