Skip to content

Instantly share code, notes, and snippets.

View sangheonhan's full-sized avatar
๐Ÿค”
Minimalizing...

Sangheon Han sangheonhan

๐Ÿค”
Minimalizing...
View GitHub Profile
@sangheonhan
sangheonhan / brewservice.pl
Created January 11, 2019 07:09
Homebrew๋กœ ์„ค์น˜ํ•œ ์„œ๋น„์Šค ์‹คํ–‰/์ค‘์ง€ ์Šคํฌ๋ฆฝํŠธ
#! /usr/bin/env perl
use strict;
use warnings;
our %services = (
'nginx' => '~/Library/LaunchAgents/homebrew.mxcl.nginx.plist',
'php55' => '~/Library/LaunchAgents/homebrew.mxcl.php55.plist',
'gearman' => '~/Library/LaunchAgents/homebrew.mxcl.gearman.plist',
'memcached' => '~/Library/LaunchAgents/homebrew.mxcl.memcached.plist',
@sangheonhan
sangheonhan / dumpgit.pl
Created January 11, 2019 07:09
ํŠน์ • ๋””๋ ‰ํ† ๋ฆฌ ์•ˆ์˜ git ์ €์žฅ์†Œ๋“ค์„ ๋คํ”„ํ•˜๋Š” ํŽ„ ์Šคํฌ๋ฆฝํŠธ
#! /usr/bin/perl
use strict;
use warnings;
if ( $#ARGV < 1 ) {
print "Usage : dumpgit.pl <git upper dir> <target dir>\n";
exit 1;
}
@sangheonhan
sangheonhan / echo.php
Created January 11, 2019 07:09
React Echo Server Example
<?php
require 'vendor/autoload.php';
$loop = React\EventLoop\Factory::create();
$dnsResolverFactory = new React\Dns\Resolver\Factory();
$dns = $dnsResolverFactory->createCached('8.8.8.8', $loop);
$connector = new React\SocketClient\Connector($loop, $dns);
@sangheonhan
sangheonhan / cleaver-firefox.css
Created January 11, 2019 07:09
firefox์—์„œ cleaver์˜ <strong>, <b>๊ฐ€ ๋ณผ๋“œ๋กœ ์ฒ˜๋ฆฌ๋˜์ง€ ์•Š๋Š” ๋ฌธ์ œ๋ฅผ ์ˆ˜์ •ํ•˜๋Š” CSS
strong, b {
font-weight: bold;
}
@sangheonhan
sangheonhan / 256colors.pl
Created January 11, 2019 07:09
ํ„ฐ๋ฏธ๋„ 256์ƒ‰ ์ถœ๋ ฅ (Perl)
#! /usr/bin/env perl
# Author: Todd Larason <[email protected]>
# $XFree86: xc/programs/xterm/vttests/256colors2.pl,v 1.2 2002/03/26 01:46:43 dickey Exp $
# use the resources for colors 0-15 - usually more-or-less a
# reproduction of the standard ANSI colors, but possibly more
# pleasing shades
# colors 16-231 are a 6x6x6 color cube
for ($red = 0; $red < 6; $red++) {
@sangheonhan
sangheonhan / hrtime.php
Created January 11, 2019 07:09
๋‚˜๋…ธ์ดˆ ๋‹จ์œ„ ์‹œ๊ฐ„ ์ธก์ •์„ ์œ„ํ•œ HRTime ์ต์Šคํ…์…˜ ์˜ˆ์ œ ์ฝ”๋“œ
<?php
$c = new HRTime\StopWatch;
$c->start();
/* do some interesting stuff*/
$c->stop();
$elapsed0 = $c->getLastElapsedTime(HRTime\Unit::NANOSECOND);
/* do something else */
@sangheonhan
sangheonhan / splip.php
Created January 11, 2019 07:07
SplType์„ ์ด์šฉํ•ด SplIp ํƒ€์ž…์„ ๋งŒ๋“œ๋Š” ์˜ˆ์ œ
<?php
class SplIp extends SplType
{
const __default = 0;
public function __construct($initial_value = '0.0.0.0', $strict = true)
{
if ($strict && ip2long($initial_value) === false) {
throw new Exception('Invalid IP');
}