Skip to content

Instantly share code, notes, and snippets.

View ryochin's full-sized avatar
🏠
Working at home

Ryo Okamoto ryochin

🏠
Working at home
View GitHub Profile
@ryochin
ryochin / lv_451_color_default_on.patch
Last active December 27, 2015 08:59
homebrew: lv patch for --default-color-on option.
diff --git a/lv.1 b/lv.1
index 8a3222f..8868daf 100644
--- a/lv.1
+++ b/lv.1
@@ -189,8 +189,8 @@ corresponding code-points, in particular, Asian charsets.
.br
.IP "-a"
Adjust character set for search pattern (default)
-.IP "-c"
-Allow ANSI escape sequences for text decoration (Color)
@ryochin
ryochin / lv_451_less_like_slash.patch
Created November 4, 2013 11:20
homebrew: lv patch for --less-like-slash option.
diff --git a/src/command.c b/src/command.c
index be32c95..2ca9ffa 100644
--- a/src/command.c
+++ b/src/command.c
@@ -413,6 +413,14 @@ private byte *CommandFindSetPattern( file_t *f, boolean_t direction )
ConsoleClearRight();
istr = CommandGetLine( f, prompt );
if( NULL == istr ){
+#if 1
+ if( NULL != f->find.pattern ){
@ryochin
ryochin / Proxy.pm
Created December 9, 2013 10:53
Plack::Middleware::Auth::Digest::Proxy for Plack::App::Proxy
package Plack::Middleware::Auth::Digest::Proxy;
use 5.008001;
use strict;
use warnings;
use parent qw/Plack::Middleware::Auth::Digest/;
use URI;
our $VERSION = '0.01';
sub call {
@ryochin
ryochin / AppledocSettings.plist
Created December 22, 2013 05:11
appledoc config
<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict>
<key>--project-name</key>
<string>Voice Droplet</string>
<key>--project-company</key>
<string>studio aquahill</string>
<key>--company-id</key>
<string>net.aquahill</string>
<key>--output</key>
@ryochin
ryochin / gist:8432098
Created January 15, 2014 07:10
Net::Twitter::Lite: workaround for restricted SSL/TLS with API 1.1
use IO::Socket::SSL;
my $twitter = Net::Twitter::Lite::WithAPIv1_1->new(
consumer_key => $config->{consumer_key},
consumer_secret => $config->{consumer_secret},
access_token => $config->{access_token},
access_token_secret => $config->{access_token_secret},
apiurl => "https://api.twitter.com/1.1",
useragent_args => {
@ryochin
ryochin / Generator.m
Created February 3, 2014 06:25
Rotated UIImage generator
- (void) run {
UIImage *img = [UIImage imageNamed: @"SampleImage@2x"];
for( int i = 0; i< 40; i++ ){
CGFloat degree = i * 4.5f;
NSString *dirName = @"/Users/john/Desktop";
NSString *fileName = [NSString stringWithFormat: @"%@/IconAnim%[email protected]", dirName, i];
NSData *data = [self rotate: img withDegree: degree];
if( [data writeToFile: fileName atomically: YES] == YES ){
@ryochin
ryochin / mysqltool.psgi
Last active May 20, 2016 07:09
psgi file for MysqlTool (wip)
# cpanm Plack CGI::Compile CGI::Emulate::PSGI
# vi htdocs/mysqltool.conf
# plackup ./mysqltool.psgi
use strict;
use warnings;
use lib qw(lib);
use CGI::Compile;
use CGI::Emulate::PSGI;
@ryochin
ryochin / Pipeline.scala
Created November 4, 2015 11:57
the pipeline operator like F#, OCaml, Elixir
package myproject
/*
via http://codereview.stackexchange.com/questions/26707/pipeline-operator-in-scala
usage:
import myproject.operator.pipeline
val f = (x: Int) => x * 2
5 |> f |> f
*/
@ryochin
ryochin / schedule.rb
Created January 21, 2017 10:09
whenever schedule file for rsnapshot
source_dir = '/app/myproject'
rsnapshot_dir = '/mnt/rsnapshot'
set :output, "#{rsnapshot_dir}/cron.log"
set :job_template, 'root :job'
nice = '/bin/nice -15'
every 1.hour, at: '00:10' do
command "#{nice} /usr/bin/rsnapshot sync && #{nice} /usr/bin/rsnapshot hourly"
@ryochin
ryochin / lsyncd.conf
Created January 21, 2017 10:15
lsyncd.conf
settings {
logfile = "/var/log/lsyncd.log",
statusFile = "/tmp/lsyncd.status",
maxDelays = 1,
}
sync {
default.rsync,
source = "/app/myproject/",
target = "/mnt/rsnapshot/current/app/myproject/",