Skip to content

Instantly share code, notes, and snippets.

@kuwa72
kuwa72 / 27-q6.sh
Created February 15, 2017 05:11
Emacsシェル芸サンプル(27回Q6) https://blog.ueda.asia/?p=9309
echo 1 | emacs -Q --batch --insert /dev/stdin --eval '(let ((bs (substring (buffer-string) 0 1))) (defun x (i s) (if (< i 10) (progn (princ (concat s "\n"))(x (+ i 1) (concat s bs))))) (x 0 bs) )'
@kuwa72
kuwa72 / 27-q1.sh
Last active February 15, 2017 05:12
Emacsシェル芸サンプル(27回Q1)https://blog.ueda.asia/?p=9309
echo abcdefghijklmn | emacs -Q --batch --insert /dev/stdin --eval '(progn (while (re-search-forward "\\(.\\)\\(.\\)" nil t) (replace-match (concat "\\1" (capitalize (match-string 2))) nil nil))(princ (buffer-string)))'
@kuwa72
kuwa72 / bf.sh
Created January 19, 2017 15:26
One line brainfuck compiler
{grep -o . | (echo '{ ptr=1;memory=() ';awk '/\[/{print "while [[ memory[$ptr] -ne 0 ]];do"} /\]/{print "done;"}/\+/{print "let $((memory[$ptr]++));"} /-/{print "let $((memory[$ptr]--));"} />/{print "let $((ptr++));"} /</{print "let $((ptr--));"} /\./{print "printf \"\\x$(printf %x $((memory[$ptr])))\";"} /,/{print "memory[$ptr]=$(head -c 1);"}';echo '}') | sh}
@kuwa72
kuwa72 / Q4.php
Created December 25, 2016 09:15
シェル芸勉強会 24回 Q4
<?php
require_once 'vendor/autoload.php';
use \PhpOffice\PhpPresentation\IOFactory;
\PhpOffice\PhpPresentation\Autoloader::register();
$oWriter = IOFactory::createReader('PowerPoint2007');
$prst = $oWriter->load(__DIR__ . '/20141019OSC_LT.pptx');
@kuwa72
kuwa72 / iobench.php
Created March 14, 2016 14:37
Tiny IO benchmark in PHP.
<?php
for ($j = 0; $j < 100; $j++) {
$time = microtime(true);
for ($i = 0; $i < 1000; $i++) {
$fn = sprintf("%04d", $i);
file_put_contents($fn . ".spf", "asdfasdfasdfasdf");
}
echo (microtime(true) - $time);
echo ",";
@kuwa72
kuwa72 / gist:8888915d5f9af7e16f4e
Last active August 29, 2015 14:17
tumblr slim dashborad for Stylish.
@namespace url(http://www.w3.org/1999/xhtml);
@-moz-document url("https://www.tumblr.com/dashboard") {
/*
I want two-pane dashboard!
span.quote { font-size: smaller; }
.l-container {width: 1200px; padding-left: 0px;}
div#left_column {width: 1200px;}
li.post_container { float:left;}
*/
@kuwa72
kuwa72 / my.ini
Created June 26, 2014 11:32
My MacType Settings(クッキリハッキリやや太め系。漢字は潰れ気味だけどコードは見やすいと思う。)
[General]
Name=my
HintingMode=2
AntiAliasMode=4
NormalWeight=-8
BoldWeight=9
ItalicSlant=-17
EnableKerning=0
GammaMode=0
LcdFilter=2
@kuwa72
kuwa72 / redminerestInterface.class.php.diff
Created April 24, 2013 10:50
TestLink 1.9.6 and Redmine2 interface patch(for Japanese). Fixed call htmlentities with character encoding for broked multibyte chars. Fix Issues url path.
diff -ru tm//lib/issuetrackerintegration/redminerestInterface.class.php /var/www/tm/lib/issue[0/494]integration/redminerestInterface.class.php
--- tm//lib/issuetrackerintegration/redminerestInterface.class.php 2013-03-10 02:20:54.000000000 +0900
+++ /var/www/tm/lib/issuetrackerintegration/redminerestInterface.class.php 2013-04-24 19:13:06.622029202 +0900
@@ -55,7 +55,7 @@
$base = trim($this-&gt;cfg-&gt;uribase,&quot;/&quot;) . '/'; // be sure no double // at end
if( !property_exists($this-&gt;cfg,'uriview') )
{
- $this-&gt;cfg-&gt;uriview = $base . 'issues/show/';
+ $this-&gt;cfg-&gt;uriview = $base . 'issues/';
}
@kuwa72
kuwa72 / gist:5381320
Created April 14, 2013 03:33
Posgres driver fix 'fetch_version' and 'pg_error' for CodeIgniter 2.1.3
161c161,164
< return "SELECT version() AS ver";
---
> $version = @pg_fetch_array(@pg_query($this->conn_id, "SELECT version() AS ver"));
> $version_array = explode(" ", $version['ver']);
> $version_array['server'] = $version_array[1];
> return $version_array;
700a704,706
> function pg_error() {
> pg_last_error();
@kuwa72
kuwa72 / gist:5381197
Last active December 16, 2015 04:59
Patch of pached CIUnit(https://bitbucket.org/kenjis/my-ciunit).
diff -ur ../../temp/kenjis-my-ciunit-27a0665997a8/application/third_party/CIUnit/config/config.php src/application/third_party/CIUnit/config/config.php
--- ../../temp/kenjis-my-ciunit-27a0665997a8/application/third_party/CIUnit/config/config.php 2012-01-18 01:27:00.000000000 +0900
+++ src/application/third_party/CIUnit/config/config.php 2013-04-03 17:56:13.738279800 +0900
@@ -8,6 +8,8 @@
*/
$config['ciu_subclass_prefix'] = 'CIU_';
+$config['log_threshold'] = 4;
+$config['log_path'] = 'logs/';