Skip to content

Instantly share code, notes, and snippets.

View grauwoelfchen's full-sized avatar
🐺
Typing with carved wooden keyboard ᕕ( ᐛ )ᕗ

Yasha grauwoelfchen

🐺
Typing with carved wooden keyboard ᕕ( ᐛ )ᕗ
View GitHub Profile
@grauwoelfchen
grauwoelfchen / keybase.md
Created August 31, 2024 15:48
keybase.md

Keybase proof

I hereby claim:

  • I am grauwoelfchen on github.
  • I am grauwoelfchen (https://keybase.io/grauwoelfchen) on keybase.
  • I have a public key whose fingerprint is 70CC BB7D E229 78EA C0C9 45EC 68D2 A3B0 548E 2A48

To claim this, I am signing this object:

@grauwoelfchen
grauwoelfchen / keybase.md
Created December 4, 2017 23:26
keybase.md

Keybase proof

I hereby claim:

  • I am grauwoelfchen on github.
  • I am grauwoelfchen (https://keybase.io/grauwoelfchen) on keybase.
  • I have a public key ASDh1WXJ60Kdk4JkbcYPdxiUBKovYI7IYd1BLNOltRy7NQo

To claim this, I am signing this object:

@grauwoelfchen
grauwoelfchen / extract-license.js.patch
Created November 6, 2016 19:10
extract-license.js.patch
--- index.js 2016-11-07 03:39:19.000000000 +0900
+++ extract-license.js 2016-11-07 03:40:03.000000000 +0900
@@ -20,15 +20,33 @@
var packagejson = this.readPackageJson(mod);
return packagejson;
},
+ extractLicense: function(packagejson) {
+ var license = packagejson.license;
+ // add support license like `{type: '...', url: '...'}`
+ if (license && license.type) {
@grauwoelfchen
grauwoelfchen / apache
Last active March 16, 2016 20:41
The dependency graphs related with oddb.org (But its versions might be too new)
% equery l -po apache
* Searching for apache ...
[-P-] [ ] www-servers/apache-2.2.31:2
[IP-] [ ] www-servers/apache-2.4.18:2
[-P-] [ ] www-servers/apache-2.4.18-r1:2
% equery g www-servers/apache-2.2.31
* Searching for apache2.2.31 in www-servers ...
* dependency graph for www-servers/apache-2.2.31
@grauwoelfchen
grauwoelfchen / skk-client.rb
Last active January 21, 2016 21:31
Client for skkserv (dbskkd-cdb)
require 'socket'
require 'thread'
socket = TCPSocket.open('127.0.0.1', 1178)
socket.set_encoding('EUC-JP')
# Response
thread = Thread.new do
while line = socket.gets
line.split.each do |l|
@grauwoelfchen
grauwoelfchen / PostgreSQL.hs
Created November 16, 2015 20:33
Postgresql backend in Yesod
{-# LANGUAGE EmptyDataDecls #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
@grauwoelfchen
grauwoelfchen / log.py
Created October 4, 2015 08:29
Generate concated logs from CloudWatch Logs using bot3 with Python3
import sys
import boto3
import time
from datetime import datetime
profile_name = 'yasuhiro.asaka'
region_name = 'REGION_NAME'
# logs
log_group_name = 'GROUP_NAME'
log_stream_name_prefix = 'PREFIX'
@grauwoelfchen
grauwoelfchen / book.rb
Last active January 31, 2020 14:34
Unit test example for cache in model class
class Book < ActiveRecord::Base
after_commit :flush_cache
def self.cached_find(id)
Rails.cache.fetch([name, id], expires_in: 30.mitues) do
where(:id => id).take!
end
end
private
@grauwoelfchen
grauwoelfchen / recursion.scm
Created August 25, 2014 16:15
Recursion with Scheme
;; (maximum '(1 2 5 4)) -> 5
;; (maximum '()) -> ERROR: maximum of empty list!
(define maximum
(lambda (xs)
(cond
((null? xs) (error "maximum of empty list!"))
((null? (cdr xs)) (car xs))
(else
(let ((x (car xs)) (y (maximum (cdr xs))))
(if (> x y) x y))))))
@grauwoelfchen
grauwoelfchen / recursion.hs
Created August 25, 2014 16:14
Recursion with Haskell
{-# OPTIONS -Wall -Werror #-}
-- maximum' [1,2,5,4] -> 5
-- maximum' [] -> *** Exception: maximum of empty list!
maximum' :: (Ord a) => [a] -> a
maximum' [] = error "maximum of empty list!"
maximum' [x] = x
maximum' (x:xs) = max x (maximum' xs)
-- replicate' 3 'a' -> "aaa"