Skip to content

Instantly share code, notes, and snippets.

View larryzhao's full-sized avatar
🐱
Meow

Larry Zhao larryzhao

🐱
Meow
View GitHub Profile
@larryzhao
larryzhao / 0_reuse_code.js
Created October 8, 2016 16:22
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
subscriber_ids = Collection.find(4).likes.pluck(:user_id)
subscription = Subscription.find_by(source_identity: "4:collection")
id = subscription.id
def func1(subscriber_ids, id)
Sider.subscription.with do |conn|
subscriber_ids.each_slice(2000) do |batch|
conn.pipelined do
batch.each do |subscriber_id|
conn.set("users:#{subscriber_id}:total_unread_subscriptions_count", 1)
@larryzhao
larryzhao / gist:446234a3af91bec917119494f9bc2384
Created September 29, 2017 10:59
strace from hanging puma process
[pid 6541] restart_syscall(<... resuming interrupted call ...> <unfinished ...>
[pid 8676] restart_syscall(<... resuming interrupted call ...> <unfinished ...>
[pid 6540] restart_syscall(<... resuming interrupted call ...> <unfinished ...>
[pid 6539] select(22, [19 21], NULL, NULL, NULL <unfinished ...>
[pid 6538] restart_syscall(<... resuming interrupted call ...> <unfinished ...>
[pid 6537] restart_syscall(<... resuming interrupted call ...> <unfinished ...>
[pid 6536] select(23, [22], NULL, NULL, {3, 567701} <unfinished ...>
[pid 6533] wait4(-1, <unfinished ...>
[pid 6537] <... restart_syscall resumed> ) = -1 ETIMEDOUT (Connection timed out)
[pid 6537] futex(0xcc33390, FUTEX_WAKE_PRIVATE, 1) = 0