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 / 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
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 / 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
@larryzhao
larryzhao / migrate.rb
Last active October 8, 2016 16:20
Migrate Sidekiq.
jobs = []
# Read from Old Sidekiq
ss = Sidekiq::ScheduledSet.new
ss.each do |job|
value = JSON.parse(job.value)
if value["class"] == "ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper"
# this is an active job
{
"tables": [
{
"txtFileName": "absolute_nav_data_fused.txt",
"tableName": "ac_nav_data_raw",
"skipLinesCount": 8,
"leadingFieldsCount": 18,
"nonRepeatedFields": {
"time": 1,
"msg_publish_time_ac_nav": 2,
编程的智慧
简叔咖啡馆20151026-你看过哪些书名平(坑)平(爹),内容却非常精彩的书 ?
是情还是色?适合女生看的9部情色电影。
那些脑洞大开创意满满的神奇短篇动画(第二弹)
为什么我不给孩子看国产动漫?看看这5部法国动漫,你就知道了!
推荐的10部长篇小说
如何从一个空有上进心的人,变成行动上的巨人?
高效记笔记,你可以的
上瘾五万年--读戴维•考特莱特《上瘾五百年》
聊聊终生学习这件事

###如何导入原始数据

  • 查看导入原始数据配置是否正确,配置应该存在于项目 preprocess/sql 目录下面,文件名叫 config.json
  • 运行 preprocess 项目
  • 点击 导入数据
  • 选择存放原始数据文本文件的文件夹,就可以开始导入
  • 原始数据文本文件的文件名需要和配置中写明的完全一致。

###如何修改原始数据文件编码

// PgTest.cpp : Defines the entry point for the console application.
#include "stdafx.h"
#include "libpq-fe.h"
#include <iostream>
#include <WinSock2.h>
#include <time.h>
#include <string.h>
#include <sstream>
#include <vector>
// MySQLTest.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include "mysql_connection.h"
#include "mysql_driver.h"
#include "cppconn\statement.h"
#include "cppconn\resultset.h"
GIT
remote: git://gitcafe.com/larryzhao/rails_emoji.git
revision: d1831cddf39dff21384693cdf9e892fbc7603fe2
branch: maleskine
specs:
rails_emoji (1.7.0)
rails (>= 3.1.0)
GIT
remote: git://github.com/alexandru/stuff-classifier.git