Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am itkq on github.
  • I am itkq (https://keybase.io/itkq) on keybase.
  • I have a public key ASDBnNWJy8KGros0EwG_jp_VkMHCY-1YYK8sTjm8xUAshAo

To claim this, I am signing this object:

[[snippets]]
description = "Get my ip address"
command = "curl ipconfig.io"
output = ""
#!/bin/bash
set -e
LIST_PATH=$HOME/.mfalist.encrypted
KEY_PATH=$HOME/.ssh/id_rsa
case $(uname) in
"Darwin") copy_cmd='pbdopy' ;;
"Linux" ) copy_cmd='xsel -bi' ;;
esac
@itkq
itkq / calc_gakubu_average.js
Last active July 10, 2017 15:33
東工大編入生が自分の学部成績の真の平均点を知るためのスクリプト
count=sum=0;$('div.tableSet01 > div > table > tbody > tr > td:nth-child(5)').each(function(){point_str=$(this).text();if(point_str=="認定"){point = 60; count++;}else if(point_str == "合格"){point=0;}else{point=Number(point_str);count++}sum+=point;});console.log(sum/count);
require 'time'
def convert_zone(orig, to_zone)
original_zone = ENV["TZ"]
utc_time = orig.gmtime
ENV["TZ"] = to_zone
to_zone_time = utc_time.localtime
ENV["TZ"] = original_zone
to_zone_time
end
@itkq
itkq / filter.rb
Created April 2, 2017 13:14
Alfred Vivaldi workflow
require 'digest/md5'
script = <<-SCRIPT
var list = new Array();
Application("Vivaldi").windows().forEach(function(window){
window.tabs().forEach(function(tab){
list.push(tab.name() + "\t" + tab.url());
});
});
list.join("\\n")
function tenki() {
local loc=${1:-大田区}
curl "wttr.in/$loc?0_lang=ja"
}
#!/bin/bash
ls /var/log/nginx/access.log-*.gz | tail -n 1 \
| xargs zgrep 404 | egrep 'php|admin|db|sql|struts' | awk '{print $1}' | uniq \
| awk '{$0="deny " $0 ";"; print}' >> /etc/nginx/dropip.conf
@itkq
itkq / docker-compose.yml
Created March 8, 2017 09:16
Dockerized Zabbix 2.4
version: '2'
services:
db-data:
image: busybox:latest
volumes:
- /var/lib/mysql
zabbix-db:
image: monitoringartist/zabbix-db-mariadb
environment:
- MARIADB_USER=zabbix
# ==== Emojis ====
# 🎨 :art: Improving structure / format of the code.
# ⚡️ :zap: Improving performance.
# 🔥 :fire: Removing code or files.
# 🐛 :bug: Fixing a bug.
# 🚑 :ambulance: Critical hotfix.
# ✨ :sparkles: Introducing new features.
# 📝 :memo: Writing docs.
# 🚀 :rocket: Deploying stuff.