Skip to content

Instantly share code, notes, and snippets.

View ravelll's full-sized avatar
👋

Yoshihide Taniguchi ravelll

👋
View GitHub Profile
@ravelll
ravelll / part_of_test.c
Last active August 29, 2015 14:26
Part of test.c in Bash source codes.
case 't': /* File fd is a terminal? */
if (legal_number (arg, &r) == 0)
return (FALSE);
return ((r == (int)r) && isatty ((int)r));
case 'n': /* True if arg has some length. */
return (arg[0] != '\0');
case 'z': /* True if arg has no length. */
return (arg[0] == '\0');
<?php
$keywords = array(
'if', 'else', 'elseif', 'endif', 'while', 'endwhile', 'do', 'as', 'for', 'endfor', 'foreach', 'endforeach',
'break', 'continue', 'switch', 'endswitch', 'case', 'default', 'declare', 'enddeclare',
'try', 'catch', 'return', 'exit', 'const', 'class', 'function',
'require', 'include', 'require_once', 'include_once',
'abstract', 'final', 'interface', 'private', 'protected', 'public', 'static',
'__LINE__', '__FILE__', '__DIR__', '__FUNCTION__', '__CLASS__', '__METHOD__', '__NAMESPACE__'
);
$functions = function_exists( 'get_defined_functions' ) ? get_defined_functions() : array();
#!/bin/sh
cd ~
if [ -e .cd ]; then
directories=$(cat .cd)
touch .cd_cleaned
for directory in $directories
do
@ravelll
ravelll / php7
Last active October 16, 2015 06:58
diff --git ext/opcache/ZendAccelerator.c ext/opcache/ZendAccelerator.c
index e6d7005..ae83c43 100644
--- ext/opcache/ZendAccelerator.c
+++ ext/opcache/ZendAccelerator.c
@@ -21,7 +21,7 @@
#include "main/php.h"
#include "main/php_globals.h"
-#include "zend.h"
+#include "Zend/zend.h"
@ravelll
ravelll / .php_cs
Created December 31, 2015 16:47
fix setting config file for StyleCI/PHP-CS-Fixer
<?php
$finder = Symfony\CS\Finder\DefaultFinder::create()
->in(__DIR__);
return Symfony\CS\Config\Config::create()
->setRules(array(
'array_element_white_space_after_comma' => true,
'array_element_no_space_before_comma' => true,
'concat_without_spaces' => true,
PID/THRD RELATIVE ELAPSD CPU SYSCALL(args) = return
862/0xef9e2: 1618605 73 3 read(0x0, "\020\0", 0x1000) = 1 0
862/0xef9e2: 1618613 8 3 select(0x1, 0x7FFF58E28110, 0x0, 0x7FFF58E28090, 0x7FFF58E28198) = 0 0
862/0xef9e2: 1618629 119713 11 select(0x1, 0x7FFF58E27F90, 0x0, 0x7FFF58E27F10, 0x7FFF58E28018) = 1 0
862/0xef9e2: 1618637 9 2 select(0x1, 0x7FFF58E27F90, 0x0, 0x7FFF58E27F10, 0x0) = 1 0
862/0xef9e2: 1618641 5 2 read(0x0, "\020\0", 0x1000) = 1 0
862/0xef9e2: 1618646 5 2 select(0x1, 0x7FFF58E28110, 0x0, 0x7FFF58E28090, 0x7FFF58E28198) = 0 0
862/0xef9e2: 1618667 12 9 ioctl(0x0, 0x80487414, 0x7FFF58E27760) = 0 0
862/0xef9e2: 1618669 3 0 ioctl(0x1, 0x4004667A, 0x7FFF58E2778C) = 0 0
862/0xef9e2: 1618670 2 0 ioctl(0x0, 0x4004667A, 0x7FFF58E2778C) = 0 0
PID/THRD RELATIVE ELAPSD CPU SYSCALL(args) = return
33276/0xf11fe: 358267 77 4 read(0x0, "\020\0", 0x1000) = 1 0
33276/0xf11fe: 358274 10 3 select(0x1, 0x7FFF4FC92120, 0x0, 0x7FFF4FC920A0, 0x7FFF4FC921B8) = 0 0
33276/0xf11fe: 358296 103713 10 select(0x1, 0x7FFF4FC91FA0, 0x0, 0x7FFF4FC91F20, 0x7FFF4FC92038) = 1 0
33276/0xf11fe: 358303 8 2 select(0x1, 0x7FFF4FC91FA0, 0x0, 0x7FFF4FC91F20, 0x0) = 1 0
33276/0xf11fe: 358307 5 2 read(0x0, "\020\0", 0x1000) = 1 0
33276/0xf11fe: 358313 6 3 select(0x1, 0x7FFF4FC92120, 0x0, 0x7FFF4FC920A0, 0x7FFF4FC921B8) = 0 0
33276/0xf11fe: 358347 13 9 ioctl(0x0, 0x80487414, 0x7FFF4FC91740) = 0 0
33276/0xf11fe: 358349 3 1 ioctl(0x1, 0x4004667A, 0x7FFF4FC9176C) = 0 0
33276/0xf11fe: 358350 2 0 ioctl(0x0, 0x4004667A, 0x7FFF4FC9176C) = 0 0
SELECT table_name, table_rows AS tbl_rows, avg_row_length AS rlen,
floor((data_length+index_length)/1024/1024) AS allMB,
floor((data_length)/1024/1024) AS dMB,
floor((index_length)/1024/1024) AS iMB
FROM information_schema.tables
WHERE table_schema=database()
ORDER BY (data_length+index_length) desc;
times in msec
clock self+sourced self: sourced script
clock elapsed: other lines
000.006 000.006: --- VIM STARTING ---
000.072 000.066: Allocated generic buffers
001.034 000.962: locale set
001.039 000.005: clipboard setup
#!/usr/bin/env ruby
require 'benchmark'
class Array
def quick_sort
return self if self.length <= 1
pivot = pop
left, right = partition { |e| e < pivot }
push pivot