Skip to content

Instantly share code, notes, and snippets.

View noomz's full-sized avatar

Siriwat Uamngamsup noomz

View GitHub Profile
@noomz
noomz / docker-compose.yml
Created April 8, 2021 10:12
kafka-get-started
version: '2'
services:
zookeeper:
image: wurstmeister/zookeeper
ports:
- "2181:2181"
kafka:
image: wurstmeister/kafka
hostname: kafka
### Keybase proof
I hereby claim:
* I am noomz on github.
* I am noomz (https://keybase.io/noomz) on keybase.
* I have a public key ASD4uadtTKGqgFrUk9gOvKbh8IeunZMe1P5AQtMh6vgAewo
To claim this, I am signing this object:
@noomz
noomz / youtube_iframe_to_width100percent.php
Created September 23, 2016 08:33
Show youtube embed as width 100%
<?php
$youtube_url = 'https://www.youtube.com/watch?v=UeR_jEx6Pzs';
// or
$youtube_url = '<iframe width="560" height="315" src="https://www.youtube.com/embed/UeR_jEx6Pzs" frameborder="0" allowfullscreen></iframe>';
if ($youtube_url) {
if (preg_match('/iframe/', $youtube_url)) {
$iframe_url = preg_replace('/width=[\"\'].*?[\"\']/', 'width="100%"', $youtube_url);
$iframe_url = preg_replace('/height=[\"\'].*?[\"\']/', 'height="100%"', $iframe_url);
$fixed = $iframe_url;
}
@noomz
noomz / problem.js
Last active October 11, 2015 17:02
console.log('Ex 1: Simple');
draw(pyramid, { height: 5, fill: true });
console.log('Ex 2: Simple custom char');
draw(pyramid, { height: 5, fill: true, fillChar: '#' });
console.log('Ex 3: Apply filter');
draw(pyramid, { height: 5, fill: true, filters: [ filterBlock ] });
console.log('Ex 4: Apply more filters');
draw(pyramid, { height: 5, fill: true, filters: [ filterBlock, filterShadow ] });
console.log('Ex 5: Simple custom char (w/ border)');
draw(pyramid, { height: 5, fill: false });
@noomz
noomz / option.sh.patch
Created June 29, 2015 07:42
phpfarm options.sh for Ubuntu
diff --git a/src/options.sh b/src/options.sh
index a172526..698728c 100755
--- a/src/options.sh
+++ b/src/options.sh
@@ -16,6 +16,7 @@ vminor=$3
vpatch=$4
configoptions="\
+--with-libdir=/lib/x86_64-linux-gnu \
--disable-short-tags \
diff -ubr php-5.3.10/ext/dom/documenttype.c ../php-5.3.10/ext/dom/documenttype.c
--- php-5.3.10/ext/dom/documenttype.c 2012-01-01 20:15:04.000000000 +0700
+++ ../php-5.3.10/ext/dom/documenttype.c 2015-06-29 14:31:37.945789850 +0700
@@ -205,7 +205,11 @@
if (buff != NULL) {
xmlNodeDumpOutput (buff, NULL, (xmlNodePtr) intsubset, 0, 0, NULL);
xmlOutputBufferFlush(buff);
+#ifdef LIBXML2_NEW_BUFFER
+ ZVAL_STRINGL(*retval, xmlOutputBufferGetContent(buff), xmlOutputBufferGetSize(buff), 1);
+#else
#!/usr/bin/env bash
# redis-server
REDIS_FOUND=$(ps aux | grep redis)
if [ ${#REDIS_FOUND[@]} -eq 1 ]
then
echo "Neet to start redis-server"
cd /tmp/ && redis-server&
fi
@noomz
noomz / boring.go
Created October 26, 2014 18:41
Node.js mimic Go concurrency : Fan In
package main
import (
"fmt"
"math/rand"
"time"
)
func main() {
c := fanIn(boring("boring Joe!"), boring("boring Ann!"))
@noomz
noomz / gist:59f9e8412a633716f524
Created September 14, 2014 14:42
COMODO SSL with NGINX
# 1. Download all cert files
# 2. Run command, replace www_example_com.crt with your domain cert
cat www_example_com.crt COMODORSAAddTrustCA.crt COMODORSADomainValidationSecureServerCA.crt AddTrustExternalCARoot.crt > ssl-bundle.crt
# 3. Upload ssl-bundle.crt and www_example_com.key to your server.
# 4. Config nginx
# ------------------------
# listen 443;
#
# ssl on;