Skip to content

Instantly share code, notes, and snippets.

View ekodedypurnomo's full-sized avatar

Eko Dedy Purnomo ekodedypurnomo

View GitHub Profile
@ekodedypurnomo
ekodedypurnomo / Instructions.md How to clone a git repo to an existing folder (not empty)
  1. First get to the existing directory
    $ cd my/folder/

  2. Now start a new git repository
    $ git init

  3. Identify if the current elements on the directory are needed or not and add them to the .gitignore file. When ready...
    $ vim .gitignore

  4. When ready create the first commit on the server

@ekodedypurnomo
ekodedypurnomo / post-mortem.md
Created December 26, 2018 14:21 — forked from joewiz/post-mortem.md
Recovery from nginx "Too many open files" error on Amazon AWS Linux

On Tue Oct 27, 2015, history.state.gov began buckling under load, intermittently issuing 500 errors. Nginx's error log was sprinkled with the following errors:

2015/10/27 21:48:36 [crit] 2475#0: accept4() failed (24: Too many open files) 2015/10/27 21:48:36 [alert] 2475#0: *7163915 socket() failed (24: Too many open files) while connecting to upstream...

An article at http://www.cyberciti.biz/faq/linux-unix-nginx-too-many-open-files/ provided directions that mostly worked. Below are the steps we followed. The steps that diverged from the article's directions are marked with an *.

    • Instead of using su to run ulimit on the nginx account, use ps aux | grep nginx to locate nginx's process IDs. Then query each process's file handle limits using cat /proc/pid/limits (where pid is the process id retrieved from ps). (Note: sudo may be necessary on your system for the cat command here, depending on your system.)
  1. Added fs.file-max = 70000 to /etc/sysctl.conf
  2. Added `nginx soft nofile 1
@ekodedypurnomo
ekodedypurnomo / _service.md
Created November 3, 2018 17:07 — forked from naholyr/_service.md
Sample /etc/init.d script

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
@ekodedypurnomo
ekodedypurnomo / BeanstalkdWorker.php
Created October 17, 2018 08:56 — forked from nikolaposa/BeanstalkdWorker.php
Beanstalkd queue worker
<?php
declare(strict_types=1);
namespace My\Queue;
use Pheanstalk\Pheanstalk;
use Exception;
class BeanstalkdWorker
@ekodedypurnomo
ekodedypurnomo / Install nginx + PHP 7.1 on CentOS 7
Created September 18, 2018 02:26
CentOS 7, nginx, PHP 7.1 Configuration
Step by step installation guide for nginx + PHP 7.1 on CentOS 7
1. Add and enable Remi repos
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum install yum-utils
yum-config-manager --enable remi-php71
2. Install php 7.1 and required modules
yum install php71-php-fpm
@ekodedypurnomo
ekodedypurnomo / config.php
Created July 26, 2018 00:50 — forked from DaveRandom/config.php
Push notification daemon example for @PeeHaa
<?php
$pidFile = __DIR__ . '/push-notify.pid';
$localSockAddr = __DIR__ . '/push-notify.sock'; // used for sending updates
$publicSockAddr = 'tcp://0.0.0.0:1337'; // bind address for push clients
$remoteSockAddr = 'tcp://127.0.0.1:1337'; // push client remote address for testing
@ekodedypurnomo
ekodedypurnomo / LICENCE SUBLIME TEXT
Created December 20, 2017 06:31
Sublime Text 3 Serial key build is 3143
## Sublime Text 3 Serial key build is 3103
—– BEGIN LICENSE —–
Michael Barnes
Single User License
EA7E-821385
8A353C41 872A0D5C DF9B2950 AFF6F667
C458EA6D 8EA3C286 98D1D650 131A97AB
AA919AEC EF20E143 B361B1E7 4C8B7F04
B085E65E 2F5F5360 8489D422 FB8FC1AA
@ekodedypurnomo
ekodedypurnomo / IndexedDB101.js
Created July 3, 2017 07:10 — forked from JamesMessinger/IndexedDB101.js
Very Simple IndexedDB Example
// This works on all devices/browsers, and uses IndexedDBShim as a final fallback
var indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB || window.shimIndexedDB;
// Open (or create) the database
var open = indexedDB.open("MyDatabase", 1);
// Create the schema
open.onupgradeneeded = function() {
var db = open.result;
var store = db.createObjectStore("MyObjectStore", {keyPath: "id"});
@ekodedypurnomo
ekodedypurnomo / DateFormatBugfix.txt
Created June 17, 2017 17:16 — forked from aghuddleston/DateFormatBugfix.txt
Ext JS 4 Grid Search Plugin originally by Saki and ported by Nathan LeBlanc for Ext JS 4
One bugfix
http://www.sencha.com/forum/showthread.php?23615-Grid-Search-Plugin&p=799141&viewfull=1#post799141
For datecolumns like:
,{
text:'date',
dataIndex:'datecreated',
xtype:'datecolumn',
format:'d.m.Y H:i'
}