Skip to content

Instantly share code, notes, and snippets.

@netmarkjp
netmarkjp / 2_Custom.sql
Last active July 14, 2022 14:41
wip-isucon11q-tranining-rust
alter table `isu_condition` add column (`condition_level` VARCHAR(20) NOT NULL);
-- alter table `isu_condition` add index (`jia_isu_uuid`, `timestamp`, `condition_level`);
alter table `isu_condition` add index (`jia_isu_uuid`, `timestamp`);
-- alter table `isu` add index (`character`);
DROP TABLE IF EXISTS `last_isu_condition`;
CREATE TABLE `last_isu_condition` (
`id` bigint(20) NOT NULL,
`jia_isu_uuid` char(36) NOT NULL,
`timestamp` datetime NOT NULL,
@netmarkjp
netmarkjp / aws_resources.py
Last active November 8, 2021 07:22
List AWS Resources(Name, ARN, Tag) from Tag Manager output
#!python
# coding: utf-8
import json
import os
import sys
def main():
"""
@netmarkjp
netmarkjp / steps.md
Created April 1, 2020 00:04
install arch example
loadkeys jp106
wpa_passphrase ssid_name passphrase > /etc/wpa_supplicant/wpa_supplicant.conf
# vi /etc/wpa_supplicant/wpa_supplicant.conf
# して scan_ssid=1 を追記
wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
dhcpcd wlan0
passwd
systemctl start sshd
@netmarkjp
netmarkjp / user.js
Created February 10, 2020 00:57
[UserScript] Swap google search language en / any
// ==UserScript==
// @name Swap google search language en / any
// @namespace https://netmark.jp/userscript/www.google.com
// @version 0.1
// @description switch search language en or all
// @author Toshiaki Baba
// @match https://www.google.com/search?*
// @grant all
// ==/UserScript==
@netmarkjp
netmarkjp / xkeysnail_config.py
Created June 27, 2019 02:02
Muhenkan treat like Alt ( only when combined usecase)
""" config """
import re
from xkeysnail.transform import K
from xkeysnail.transform import Key
from xkeysnail.transform import define_keymap
from xkeysnail.transform import define_modmap
from xkeysnail.transform import define_multipurpose_modmap
define_modmap({
Key.CAPSLOCK: Key.LEFT_CTRL
@netmarkjp
netmarkjp / .Xmodmap
Created June 26, 2019 11:43
xremap: use Muhenkan as modifier
add mod3 = Muhenkan
@netmarkjp
netmarkjp / systemctl_edit_oneliner.sh
Created December 13, 2016 22:06
oneliner: edit systemd config with systemctl
EDITOR=tee sudo -E bash -c '( echo "[Service]" ; echo "ExecStart=" ; echo "ExecStart=/usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:2375" ) | systemctl edit docker.service'
@netmarkjp
netmarkjp / main.go
Last active December 23, 2015 14:24
golang async worker example
package main
import (
"fmt"
"time"
)
func main() {
task := make(chan string)
taskquit := make(chan bool)
# GCEでUbuntu 15.04
sudo su -
apt-get update && apt-get -y install ansible jq
git clone https://github.com/isucon/isucon5-qualify.git
cd isucon5-qualify/
cd gcp/bench/ansible/
sed -i 's/- copy/#- copy/' 00_devel.yml
sed -i 's@key_file=.*@@' 06_deploy_bench_tool.yml
sed -i 's@repo=.*@repo=https://github.com/isucon/isucon5-qualify.git@' 06_deploy_bench_tool.yml
@netmarkjp
netmarkjp / ajax_post_form.js
Created August 18, 2015 15:54
ajax post form with jQuery
$("#enqueue_form").submit(function(event) {
event.preventDefault(); //cancel event
var form_data = new FormData($("#enqueue_form").get(0));
$.ajax({
url: "/bench",
type: "POST",
data : form_data,
dataType: "json",
processData: false,
contentType: false,