Skip to content

Instantly share code, notes, and snippets.

View littlebookboy's full-sized avatar

Gene Su littlebookboy

View GitHub Profile
@littlebookboy
littlebookboy / proxy_info.txt
Created August 25, 2022 04:01 — forked from ericzon/proxy_info.txt
Example of Tiny proxy with Basic auth
brew install tinyproxy
tinyproxy -c /usr/local/etc/tinyproxy/tinyproxy.conf -d
Tests:
NO AUTH
curl -iv --noproxy "*" --location http://www.google.com
AUTH FAIL
@littlebookboy
littlebookboy / index.html
Created May 10, 2022 08:38 — forked from alecordev/index.html
Example vanilla JS WebSocket
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
// use vanilla JS because why not
window.addEventListener("load", function() {
// create websocket instance
var mySocket = new WebSocket("ws://localhost:8080/ws");
@littlebookboy
littlebookboy / macosx-install-php-oracle-oci8.md
Created September 6, 2021 10:00 — forked from yajra/macosx-install-php-oracle-oci8.md
install Oracle PHP Extension (oracle OCI8) - instantclient for Mac OS 10.8 - homebrew environnement

Installation

This procedure is tested on Mac OS X 10.8 with Developpers tools installed (xCode).

PHP 5.4 installed with Homebrew.

Update: I wrote a blog post about this.

Preparation

Download the following files from Oracle website (yes, you need to create an account and accept terms):

Real-time PHP-FPM Status

This gist will explain you how to enable an undocumented feature of PHP-FPM which will give a real-time performance stats.

Everybody knows the famous phpinfo() and the page it generates, right? Then the real-time PHP-FPM status page design is very similar.

image

Some informations from the top are not displayed to avoid security issues.

Enable PHP-FPM Status

Linux中常用的監控CPU整體性能的工具有:
§ mpstat: mpstat 不但能查看所有CPU的平均信息,還能查看指定CPU的信息。
§ vmstat:只能查看所有CPU的平均信息;查看cpu隊列信息;
§ iostat: 只能查看所有CPU的平均信息。
§ sar: 與mpstat 一樣,不但能查看CPU的平均信息,還能查看指定CPU的信息。
<?php
echo "This is a hugo shortcode sample.";

Web Development with Laravel 5

目標

如何在開發的過程中加入測試。

  1. Model
  2. Repository
  3. Controller
  4. Auth
@littlebookboy
littlebookboy / joel_on_softwate_notes.md
Last active April 15, 2022 03:57
Joel On Software 約耳趣談軟體閱讀筆記

Part 1 位元與位元組:程式設計的實踐

CH01 選擇一種語言

  • 不基於語法選擇程式語言,而是看需求,選最適合的

CH02 回歸簡單原則

  • 比原來更深入,去追,去了解你在使用的程式,已經被做完的那些 code 是寫些什麼
@littlebookboy
littlebookboy / more_joel_on_softwate_notes.md
Last active May 20, 2022 23:34
More Joel On Software 約耳續談軟體閱讀筆記

Part 1 人員管理

CH01 我的BILLG審查初體驗

  • 寫規格的人,必須完全掌握你的規格,與關聯到的所有實作細節、邏輯

CH02 尋找優秀的開發人員

  • 各領域中最好的人才不會出現在人力市場,而且他們花在「應徵」這件事上的時間很短
@littlebookboy
littlebookboy / remove_emoji.php
Created December 4, 2018 10:52
移除 emoji 測試
<?php
function filterEmoji ($string) {
return preg_replace_callback(
'/./u',
function (array $match) {
return strlen($match[0]) >= 4 ? '' : $match[0];
},
$string
);
}