Skip to content

Instantly share code, notes, and snippets.

View bootjp's full-sized avatar
🏠
Working from home

Yoshiaki Ueda (bootjp) bootjp

🏠
Working from home
View GitHub Profile
@bootjp
bootjp / gist:d7634e9792b802825a77
Last active September 19, 2015 07:09 — forked from jonathanmoore/gist:2640302
Get the share counts from various APIs

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter

@bootjp
bootjp / gist:83626973f7674e28f1ef29a250ea0b6e
Created October 7, 2016 13:31
Linuxカーネルのチューニング

設定内容

# vim /etc/sysctl.conf
# 共有メモリの最大サイズ。サーバーの搭載メモリ(1GB)に合わせて変更
kernel.shmmax      = 1073741824
@bootjp
bootjp / 0_reuse_code.js
Created September 20, 2017 06:48
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
@bootjp
bootjp / main.go
Created January 8, 2018 09:19 — forked from enricofoltran/main.go
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
@bootjp
bootjp / check_docker_container.sh
Created January 10, 2018 06:29 — forked from ekristen/check_docker_container.sh
Bash Script for Nagios to Check Status of Docker Container
#!/bin/bash
# Author: Erik Kristensen
# Email: [email protected]
# License: MIT
# Nagios Usage: check_nrpe!check_docker_container!_container_id_
# Usage: ./check_docker_container.sh _container_id_
#
# Depending on your docker configuration, root might be required. If your nrpe user has rights
# to talk to the docker daemon, then root is not required. This is why root privileges are not
@bootjp
bootjp / detect_marker.py
Created April 30, 2018 12:43 — forked from ksasao/detect_marker.py
ZOZOSUITのマーカーのIDを読み取るコードです。公開されている画像を元に独自に解析しているので、公式ではこのように処理しているかどうかは不明です。
import numpy as np
import random
import math
import cv2
from PIL import Image
def detect_markers(im):
markers = []
# 輪郭線抽出のための二値化
im_gray = cv2.cvtColor(im, cv2.COLOR_BGR2GRAY)
@bootjp
bootjp / latency.txt
Created October 9, 2018 13:19 — forked from eshelman/latency.txt
HPC-oriented Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
L1 cache reference/hit 1.5 ns 4 cycles
Floating-point add/mult/FMA operation 1.5 ns 4 cycles
L2 cache reference/hit 5 ns 12 ~ 17 cycles
Branch mispredict 6 ns 15 ~ 20 cycles
L3 cache hit (unshared cache line) 16 ns 42 cycles
L3 cache hit (shared line in another core) 25 ns 65 cycles
Mutex lock/unlock 25 ns
L3 cache hit (modified in another core) 29 ns 75 cycles
@bootjp
bootjp / instructions.md
Created January 21, 2019 04:55 — forked from Ind3xOnGitHub/instructions.md
Oculus Rift + Vive Trackers setup

Oculus Rift + Vive Trackers setup

It's recommend to use the Vive Trackers 2018 since they have less interference with the Oculus Touch controllers. Also some of the steps are only necessary for the moment because of some bugs and broken tools.

I recommend you to join this Discord server if you have any questions: https://discord.gg/bkRgTVw. You can also check this document for fixes to some common issues.

Written by Ind3x. Thanks to Dj Lukis.LT and Kaori for several additional hints.

  1. Install SteamVR, start it and finish the tutorial if necessary
  2. Open the file Steam\config\steamvr.vrsettings with Windows' Notepad and add the following to the beginning of the steamvr section. Click here to see a short video on how to do that.
@bootjp
bootjp / mongoid_3_multiple_database.txt
Created November 5, 2019 05:54 — forked from hwatkins/mongoid_3_multiple_database.txt
Mongoid 3.x multiple database
If you want to use multiple dbs at once there are several different ways...
1) If you want to do this on a per-model level, use .store_in (This is for all threads):
class Band
include Mongoid::Document
store_in database: "secondary" # This can be any name you want, no need to put it in the mongoid.yml.
end
class Artist
@bootjp
bootjp / JavaScript.md
Created April 26, 2020 01:24 — forked from kenmori/JavaScript.md
JavaScript練習問題集(ECMAScript2015,2016,2017,2018,2019,2020,other Library)

JavaScript練習問題集

JavaScript

更新情報

・問題を追加(2020/4/18)
・表記揺れを整理(2020/1/13)
・TypeScript問題集のリンク追加(2019/7/13)