Skip to content

Instantly share code, notes, and snippets.

💭
I may be slow to respond.

Kuniwak Kuniwak

💭
I may be slow to respond.
Block or report user

Report or block Kuniwak

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View ack-sed
#!/usr/bin/env ruby
if ARGV.size != 3
puts "usage: ack-sed <pattern> <replace-string> <dir>"
end
query, replace, dir = ARGV
system("ack #{query} #{dir} | cut -d':' -f1 | uniq | LANG=C xargs sed -i -e 's/#{query}/#{replace}/g'")
View .vimrc
if has("gui_running")
set fuoptions=maxvert,maxhorz
au GUIEnter * set fullscreen
endif
View codegolf_circle_75.js
for(s='',x=y=n=40;y+n;s+='-*\n'[x+n?x*x--+y*y<900|0:(x=n,y-=2,2)]);return s
@rch850
rch850 / irc.sh
Created Sep 27, 2013
シェルスクリプトからIRCで発言
View irc.sh
#!/bin/sh
nc -w 10 $IRC_SERVER 6667 << EOF &>/dev/null
PASS $IRC_PASS
NICK $IRC_NICK
USER $IRC_NICK 8 * : $IRC_NICK
JOIN $IRC_CH
PRIVMSG $IRC_CH : $1
QUIT
EOF
View 絶望しかない.java
Set<String> keys = map.keySet();
for (String key : keys) {
//some condes
}
//↑が↓になった
Set<String> keys = map.keySet();
String[] keyarray = keys.toString().split(",");
for(int i=0; i<keyarray.length; i++){
@taiki45
taiki45 / fizzubzz.hs
Created Dec 17, 2013
http://bugrammer.hateblo.jp/entry/2013/12/15/220418 を読んで、こう書けばモーナド♡って気持ち、表現できたのではとおもってみたりでし
View fizzubzz.hs
fizz x = if x `mod` 3 == 0 then Left "fizz" else Right x
buzz x = if x `mod` 5 == 0 then Left "buzz" else Right x
fizzbuzz x = if x `mod` 15 == 0 then Left "fizzbuzz" else Right x
number x = Left $ show x
doFizzBuzz x = either id id $ fizzbuzz x >>= buzz >>= fizz >>= number
main = foldr1 (>>) $ fmap putStrLn (fmap doFizzBuzz [1..])
View return_if.rb
class Binding
def return_if(name)
eval "return #{name}" if local_variable_get(name)
end
end
def foo(v)
binding.return_if(:v)
'v is nil'
end
View OnePlusOneIsTwo.swift
class Number {}
class Zero : Number {}
class Succ<N:Number> : Number {}
typealias One = Succ<Zero>
typealias Two = Succ<Succ<Zero>>
typealias Three = Succ<Succ<Succ<Zero>>>
class Eq<S: Number, T: Number> {}
class Add<S: Number, T:Number> : Number {}
@waltarix
waltarix / tmux-do-not-combine-utf8.patch
Last active Mar 11, 2018
tmux: Fix a problems with displaying Ambiguous-width, Japanese Dakuten and Handakuten signs.
View tmux-do-not-combine-utf8.patch
diff --git a/screen-write.c b/screen-write.c
index 15f8d07..8a175a6 100644
--- a/screen-write.c
+++ b/screen-write.c
@@ -1334,6 +1334,7 @@ screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc)
ctx->cells++;
/* If the width is zero, combine onto the previous character. */
+ /*
if (width == 0) {
View value-witness-table.cpp
// swift/stdlib/public/runtime/Metadata.cpp をプリプロセッサのみ実行した結果から抜粋
struct ValueWitnessTable;
namespace value_witness_types {
typedef OpaqueValue * (*initializeBufferWithCopyOfBuffer) (ValueBuffer *, ValueBuffer *, const Metadata *);
typedef void (*destroy) (OpaqueValue *, const Metadata *);
typedef OpaqueValue * (*initializeWithCopy) (OpaqueValue *, OpaqueValue *, const Metadata *);
typedef OpaqueValue * (*assignWithCopy) (OpaqueValue *, OpaqueValue *, const Metadata *);
typedef OpaqueValue * (*initializeWithTake) (OpaqueValue *, OpaqueValue *, const Metadata *);
You can’t perform that action at this time.