Skip to content

Instantly share code, notes, and snippets.

View tinoji's full-sized avatar

Hiroaki Kikuchi tinoji

View GitHub Profile
@tinoji
tinoji / notify_commad_finished_to_desktop.md
Created May 28, 2021 03:59
Notify the command is finished to desktop

Install

npm install -g node-notifier-cli
alias notifycmd='notify --timeout false -m "done: $?"'

Usage

<any command> ; notifycmd
@tinoji
tinoji / github_organization_activity.py
Last active October 5, 2021 17:59
Plot commit activity of a GitHub organization in last year
import isoweek
import datetime
import matplotlib.pyplot as plt
from github import Github
from operator import add
g = Github("{user}", "{password}")
# For GitHub Enterprise
# g = Github(base_url="https://{hostname}/api/v3", login_or_token="{access_token}")
@tinoji
tinoji / FtpUtil.cs
Created December 25, 2019 06:24
Check file exists and make directories recursively by FTP
public static class FtpUtil
{
/// <returns>exists, ok, error message</returns>
public static (bool, bool, string) FileExists(string ftpUrl, string fileName, string user, string password)
{
WebRequest request = WebRequest.Create(ftpUrl);
request.Credentials = new NetworkCredential(user, password);
request.Method = WebRequestMethods.Ftp.ListDirectory;
try
@tinoji
tinoji / array_shared_dict.lua
Last active August 3, 2019 15:59
Use array in OpenResty shared memory dictionary
local _M = {}
local function split(str, separator)
local result = {}
local pattern = '[^' .. separator .. ']+'
for tmp in string.gmatch(str, pattern) do
table.insert(result, tmp)
end
@tinoji
tinoji / selenium_screenshot_to_slack.py
Last active October 31, 2021 19:22
Take screenshot and send it to Slack by Selenium
# coding: utf-8
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.keys import Keys
import requests
import json
import os
import time
BASEDIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "screenshots/")
@tinoji
tinoji / lua_syntax_check.md
Created May 31, 2018 15:57
Luaの構文チェック
@tinoji
tinoji / proxmox_lxc_pct_provisioner.sh
Created February 7, 2018 01:02
Create and provision Proxmox LXC by pct command
pct create <id> /var/lib/vz/template/cache/centos-7-default_20170504_amd64.tar.xz \
-arch amd64 \
-ostype <centos|ubuntu|etc> \
-hostname <hostname> \
-cores <cores> \
-memory <memory(MB)> \
-swap <swap(MB)> \
-storage local-lvm \
-password \
-net0 name=eth0,bridge=<bridge>,gw=<gateway>,ip=<cidr>,type=veth &&\
@tinoji
tinoji / TwoServosForLight.ino
Last active January 8, 2018 01:57
照明のスイッチをON/OFFするためのArduinoスケッチ
void setup() {
pinMode(1, OUTPUT);
pinMode(9, OUTPUT);
pinMode(A0, INPUT);
Serial.begin(9600);
}
void loop() {
int inputValue = analogRead(A0);
# -*- coding: utf-8 -*-
from __future__ import print_function
import glob
import time
start = time.time()
file_name = []
first = []
other = []