Skip to content

Instantly share code, notes, and snippets.

View kumagi's full-sized avatar
:octocat:
Fine.

Hiroki KUMAZAKI kumagi

:octocat:
Fine.
View GitHub Profile
#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);
@kumagi
kumagi / hashtable.rs
Created March 17, 2017 16:09
rust初体験
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
(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))
// 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;
#include <fstream>
#include <chrono>
#include <iostream>
#include <vector>
#include <cmath>
#include <unistd.h>
int main(void) {
constexpr int size = 8192;
constexpr int tries = 1024;
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.
#include <stdio.h>
#include <pthread.h>
#include <sys/eventfd.h>
#include <unistd.h>
struct workset {
int tid_;
int efd_;
};
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#include <stdint.h>
#include <sys/time.h>
#include <assert.h>
int main(void) {
size_t a = 2;
int b = 10;
@kumagi
kumagi / jubatus_cluster.py
Created July 5, 2016 12:13
出力を見てあれこれする
import subprocess
import sys
import os
import signal
import time
import re
class JubatusCluster(object):
def __init__(self):
self.procs = {}
@kumagi
kumagi / kenasaku_ouen.rb
Last active March 11, 2016 02:54
検索は応援になる
require 'selenium-webdriver'
class KensakuOuen
def initialize()
@driver = Selenium::WebDriver.for :firefox
end
def search(keyword)
begin
@driver.manage.delete_all_cookies
@driver.get "http://www.yahoo.co.jp"