Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Yuki Matsukura matsubo

🏠
Working from home
View GitHub Profile
@matsubo
matsubo / wordpress.rb
Created Nov 12, 2020
Post image to wordpress and use it in the article.
View wordpress.rb
require 'faraday'
require 'base64'
require 'json'
# Generated password using application-passwords plugin
authorization = 'Basic ' + Base64.encode64('username:password')
# post image
View index.js
var os = require('os')
module.exports = Franz =>
class Gmail extends Franz {
overrideUserAgent() {
if (os.platform() == 'linux')
return "Mozilla/5.0 (X11; Linux x86_64; rv:72.0) Gecko/20100101 Firefox/72.0"
else
return "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36";
}
@matsubo
matsubo / Gemfile
Last active Aug 20, 2020
quick and dirty code for prototyping
View Gemfile
# frozen_string_literal: true
source "https://rubygems.org"
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
gem "influxdb"
gem "logger"
View prefectures.json
[
["北海道", "", "hokkaido"],
["青森県", "あおもり", "aomori"],
["岩手県", "いわて", "iwate"],
["宮城県", "みやぎ", "miyagi"],
["秋田県", "あきた", "akita"],
["山形県", "やまがた", "yamagata"],
["福島県", "ふくしま", "fukushima"],
["茨城県", "いばらき", "ibaraki"],
["栃木県", "とちぎ", "tochigi"],
@matsubo
matsubo / README.md
Last active Jan 28, 2021 — forked from gbraad/README.md
Buy me a coffee
View README.md

HTML tag

Buy Me A Coffee

MarkDown

Buy Me a Coffee

View gist:488d23a674231bacf4032fc9cc37088f
require 'bundler/setup'
Bundler.require
class Rtx830
def initialize(hash = {})
username = hash[:username] || 'admin'
password = hash[:password] || 'admin'
View fail2ban.sh
#!/bin/bash
set -eu
date=`date +%s`
drop=`iptables -nL |grep f2b-blacklist -A 10000 | grep \^DROP|wc -l`
reject=`iptables -nL|grep f2b-sshd -A 10000|grep REJECT|wc -l`
echo -e "fail2ban.ipv4.drop\t${drop}\t${date}"
View mackerel-agent.conf
[plugin.metrics.dht11]
command = "sudo -u pi python3 /home/pi/DHT11_Python/mackerel.py"
type = "metric"
View 社外の人材との契約形態.md
  • 業務委託契約
    • 請負契約
    • 準委任契約(=SES契約)
  • 派遣契約
@matsubo
matsubo / arp_table_usage.sh
Created Jun 7, 2020
Get current stat via telnet on RTX830
View arp_table_usage.sh
#!/bin/bash
HOST=$1
COMMAND="show arp"
$(dirname $0)/rtx_command.sh $HOST "${COMMAND}" | grep "Count" | awk '{print $2}'