Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
Fine.

Hiroki KUMAZAKI kumagi

:octocat:
Fine.
View GitHub Profile
@kumagi
kumagi / code_reading.md
Created Mar 12, 2019 — forked from taichi/code_reading.md
太一のコードの読み方メモ
View code_reading.md

太一のコードの読み方メモ

全体として太一が感覚的に実践している事を論理的に説明しようと試みている為、
説明の粒度が適切でなかったり一貫性が無いように見える部分があるかもしれない。
普段やっているけども書ききれていない事も多分きっとある。

コードを読むとは何か

  • コードを嗜む
  • コードを学ぶ
  • 武器を手に入れる
View deploy.rb
# config valid only for current version of Capistrano
lock "3.8.2"
set :application, "my_application"
set :repo_url, "git@github.com:kumagi/my_application"
set :branch, 'master'
set :deploy_to, "/opt/my_application"
set :format, :airbrussh
View devise_memo.md

Sign up Link

<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
  <%= link_to "Sign up", new_registration_path(resource_name) %><br />
<% end -%>
View papi_example.cpp
#include <papi.h>
#include <stdio.h>
#include <iostream>
#include <vector>
int main() {
std::vector<int> Events = {
PAPI_BR_MSP,
PAPI_BR_NTK,
PAPI_TLB_IM
View slow_client.cpp
#include <sys/socket.h>
#include <thread>
#include <iostream>
#include <unistd.h>
#include <netinet/in.h>
#include <arpa/inet.h>
int main() {
sockaddr_in addr;
addr.sin_family = AF_INET;
addr.sin_port = htons(12345);
View hashtable.rs
0 is empty! so first insert to 0
1 is empty! so first insert to 1
extend to 4 !
rehash key:0 into slot:0
rehash key:1 into slot:1
2 is empty! so first insert to 2
3 is empty! so first insert to 3
extend to 8 !
rehash key:0 into slot:0
rehash key:1 into slot:1
View cmake_build.el
(require 'cl)
(require 'compile)
(defun upward-find-file (filename &optional startdir)
(let
((dirname (expand-file-name
(if startdir startdir ".")))
(found nil)
(top nil))
(while (not (or found top))
View slack_crawler.js
// Configuration: Obtain Slack web API token at https://api.slack.com/web
var API_TOKEN = PropertiesService.getScriptProperties().getProperty('slack_api_token');
if (!API_TOKEN) {
throw 'You should set "slack_api_token" property from [File] > [Project properties] > [Script properties]';
}
Logger.log("API_" + API_TOKEN);
var FOLDER_NAME = 'Slack Logs';
/**** Do not edit below unless you know what you are doing ****/
var COL_LOG_RAW_JSON = 1;
var COL_MAX = COL_LOG_RAW_JSON;
View latencybench.cpp
#include <fstream>
#include <chrono>
#include <iostream>
#include <vector>
#include <cmath>
#include <unistd.h>
int main(void) {
constexpr int size = 8192;
constexpr int tries = 1024;
View lld cmake error
lld/build$ cmake -G Ninja ..
CMake Error at CMakeLists.txt:6 (string):
string sub-command REGEX, mode MATCH needs at least 5 arguments total to
command.
-- LLD version:
CMake Error at CMakeLists.txt:10 (string):
string sub-command REGEX, mode REPLACE needs at least 6 arguments total to
command.
You can’t perform that action at this time.