Skip to content

Instantly share code, notes, and snippets.

View ueokande's full-sized avatar
🙆‍♀️
LGTM

Shin'ya Ueoka ueokande

🙆‍♀️
LGTM
View GitHub Profile
@ueokande
ueokande / electron_test.js
Last active March 4, 2016 14:23
ElectronのRendererプロセスのテスト ref: http://qiita.com/ueokande/items/ea5b985f0ebe0e84f29d
describe('Electron renderer process', function() {
describe('document object', function() {
it('is an Document object', function() {
expect(window.document).to.be.an.instanceof(Document);
});
});
});
@ueokande
ueokande / xgamma_dialog
Created March 13, 2016 09:12
Gamma configuration by Dialog
#!/bin/bash
value=$(dialog --rangebox 'Gamma' 10 72 -10 10 0 2>&1 >/dev/tty)
[[ $? -ne 0 ]] && exit 1
gamma=$(python -c "print(10 ** ($value / 10))")
xgamma -gamma $gamma
xgamma 2>&1 | cut -f 10 -d' '
@ueokande
ueokande / morse_led.cpp
Created April 1, 2016 23:38
Morse Code for LED in Linux
#include <iostream>
#include <chrono>
#include <thread>
#include <vector>
#include <cstdio>
constexpr std::chrono::milliseconds operator""_tick(unsigned long long int tick) {
return std::chrono::milliseconds(tick * 200);
}
@ueokande
ueokande / notification-on-hatenablog.html
Last active October 6, 2016 12:34
Notification on hatenablog
<style>
.popup {
position: relative;
left: 32px;
right: 32px;
bottom: 32px;
background-color: #333;
color: white;
position: fixed;
padding: 16px;
#!/bin/sh
print_primes() {
for i in `seq 6 $1`; do
test=$(echo $i | factor | awk 'NF==2{print $2}')
if [ -n "$test" ]; then
echo $i
fi
done
}
function waitForKintone(success, error, timeout) {
const startAt = new Date().getTime();
function recursive() {
if (window.hasOwnProperty('kintone')) {
console.log("has kintone");
func();
} else if (new Date().getTime() - startAt > timeout) {
console.log("not has kintone");
error();
@ueokande
ueokande / timeout.java
Created February 23, 2017 01:50
Timeout in java
String synchronizedHeavyMethod(Duration timeout) throws TimeoutException {
Instant deadline = Instant.now().plus(timeout);
while (Instant.now().isBefore(deadline)) {
// doSomething() resutrns nullable String
String result = doSomething();
if (Objects.isNull(result)) {
continue;
}
return result;
}
@ueokande
ueokande / benchmark-commands.md
Last active February 7, 2025 07:46 — forked from jkreps/benchmark-commands.txt
Kafka Benchmark Commands

Benchmark commands

Producer

Setup

bin/kafka-topics.sh \
  --zookeeper zookeeper.example.com:2181 \
  --create \
April 2017
Su Mo Tu We Th Fr Sa
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30
var page = require('webpage').create();
page.open('http://www.tamagoya.co.jp/menu_list.html', function() {
var rect = page.evaluate(function() {
var menuDate = Array.prototype.find.call(
document.querySelectorAll('.menutitle_date'),
(e) => e.textContent.includes("26") );
var menuTitle = menu_date.parentElement;
var menuList = menuTitle.nextElementSibling
var menuBottom = menuList.nextElementSibling