Skip to content

Instantly share code, notes, and snippets.

View y13i's full-sized avatar
☘️

Yoriki Yamaguchi y13i

☘️
View GitHub Profile
@subelsky
subelsky / large_redshift_tables.sql
Created April 18, 2014 17:39
Quick SQL command to find large tables in redshift
-- based on http://stackoverflow.com/questions/21767780/how-to-find-size-of-database-schema-table-in-redshift
SELECT name AS table_name, ROUND((COUNT(*) / 1024.0),2) as "Size in Gigabytes"
FROM stv_blocklist
INNER JOIN
(SELECT DISTINCT id, name FROM stv_tbl_perm) names
ON names.id = stv_blocklist.tbl
GROUP BY name
ORDER BY "Size in Gigabytes" DESC
@omasanori
omasanori / gist:7858569
Last active April 25, 2025 08:53
Rustのパターンマッチの話

Rustのパターンマッチの話

既に穴だらけですが、やれるだけやっていきます。今回はパターンマッチの話です。

TL;DR(経験者向け)

はい、あなたのよく知るパターンマッチです。ガードも使えますが、他の言語でガードを使うパターンの一部はOCamlのorパターンと同等の機能や範囲を表す機能によって置き換えることができます。

@tatzyr
tatzyr / image.md
Last active December 19, 2024 01:04
Markdownで画像を表示する

Markdownで画像を表示する

Markdownでは文書中に画像ファイルを表示することができる。GitHubでReadmeに使うと見栄えがいい。

エビフライトライアングル

Markdown記法で書くならこんな感じ。"サンプル"の部分は省略可能。

![エビフライトライアングル](http://i.imgur.com/Jjwsc.jpg "サンプル")
@melborne
melborne / list.rb
Created June 17, 2012 10:17
list method implementation with `inject`
class List < Array
undef_method *%w(inject map size at index select reject detect all? any? one? none? min max minmax take_while grep include? partition group_by count join assoc zip reverse values_at compact take flat_map product) # !> `*' interpreted as argument prefix
def inject(init, &blk)
return init if empty?
(drop 1).inject( yield(init, first), &blk)
end
def map
inject([]) { |m, x| m << yield(x) }
@rummelonp
rummelonp / faraday.md
Last active May 20, 2022 12:23
Ruby の HTTP クライアントライブラリ Faraday が便利そう

Ruby の HTTP クライアントライブラリ Faraday が便利そう

Ruby の HTTP クライアントライブラリ Faraday が便利そう

API ラッパの開発には [RestClient gem][rest_client_gem] だとか
OAuth の必要なものは [Net/HTTP][net_http] + [OAuth gem][oauth_gem] を使ってた

[Twitter gem][twitter_gem] や [Instagram gem][instagram_gem] など API ライブラリのソースを読んでみると
[Faraday gem][faraday_gem] というものがよく使われてた

@poochin
poochin / gist:1423262
Created December 2, 2011 13:35
sl コマンドに京急AAを追加するパッチです
diff -c sl/sl.c sl_kq/sl.c
*** sl/sl.c 1998-07-22 23:01:01.000000000 +0900
--- sl_kq/sl.c 2011-12-02 21:34:09.540165908 +0900
***************
*** 33,73 ****
#include "sl.h"
int ACCIDENT = 0;
int LOGO = 0;
int FLY = 0;
@chitchcock
chitchcock / 20111011_SteveYeggeGooglePlatformRant.md
Created October 12, 2011 15:53
Stevey's Google Platforms Rant

Stevey's Google Platforms Rant

I was at Amazon for about six and a half years, and now I've been at Google for that long. One thing that struck me immediately about the two companies -- an impression that has been reinforced almost daily -- is that Amazon does everything wrong, and Google does everything right. Sure, it's a sweeping generalization, but a surprisingly accurate one. It's pretty crazy. There are probably a hundred or even two hundred different ways you can compare the two companies, and Google is superior in all but three of them, if I recall correctly. I actually did a spreadsheet at one point but Legal wouldn't let me show it to anyone, even though recruiting loved it.

I mean, just to give you a very brief taste: Amazon's recruiting process is fundamentally flawed by having teams hire for themselves, so their hiring bar is incredibly inconsistent across teams, despite various efforts they've made to level it out. And their operations are a mess; they don't real