Skip to content

Instantly share code, notes, and snippets.

View metalefty's full-sized avatar
♥️
Looking for sponsors

metalefty

♥️
Looking for sponsors
View GitHub Profile

Keybase proof

I hereby claim:

  • I am metalefty on github.
  • I am metalefty (https://keybase.io/metalefty) on keybase.
  • I have a public key ASCcb_WiniwgxBkv37IJXByHw2pHOA40WGvC5LglViLeEgo

To claim this, I am signing this object:

#!ruby
mac_vendors = Hash.new
File.open('./oui.txt') do |f|
array = f.readlines
array.each do |e|
next unless e =~ /\(hex\)/
k, v = e.split(/\(hex\)/)
mac_vendors.store(k&.gsub(/-/, ':')&.strip&.upcase, v&.strip)
@metalefty
metalefty / installation_en.md
Last active November 8, 2018 00:22
SpamAssassin Japanese patch installation guide in English

Installation

Installation

Prerequisites

Beforehand, install these softwares. 2,3,4 are required to use Tokenizer::MeCab plugin. 5,6,7 are not necessary but improves detection accuracy in Japanese and Chinese.

/*
* Copyright 2018 HAW International, Inc.
* Copyright 2018 Koichiro Iwao <meta@vmeta.jp> a.k.a metalefty on GitHub
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@metalefty
metalefty / gist:9a444e325a98ad4f11cd01d91978e957
Created August 22, 2018 06:26
readlink -f の代わり
# GNU/Linux, FreeBSD, macOS それぞれでちゃんと機能する readlink -f の代わり
# 出典: https://github.com/metalefty/lockman/blob/master/lockman.sh#L203
absolute_path()
{
echo $(cd $(dirname $1) && pwd)/$(basename $1)
}
# これを
#
@metalefty
metalefty / ooklagrapher.py
Last active July 2, 2020 01:52
speedtest-cliで蓄積した速度測定データをいい感じに表示するやつ
#!/usr/bin/env python3
import csv
import sys
import numpy as np
from matplotlib import pyplot
from datetime import datetime, timezone
from dateutil.parser import parse
from matplotlib import dates as mdates
@metalefty
metalefty / route53-ddns.sh
Last active January 15, 2018 05:39
Amazon Route 53 でDDNSするやつ
#!/bin/sh
export LANG=C
# 環境変数に AWS_ACCESS_KEY_ID と AWS_SECRET_ACCESS_KEY をセットしておく
DIG="dig +noedns"
CURL="curl -s"
TTL=10
IP4ADDR_CUR=$(${CURL} http://checkip.amazonaws.com)
@metalefty
metalefty / ab-shutter3-presentation.sh
Last active November 9, 2019 08:10
ダイソーのBluetoothリモートシャッターをMacでいい感じに使うやつ
#!/bin/sh
while true
do
hidutil property \
--filter '{ "VendorID": 9354, "ProductID": 33382 }'\
--set '{
"UserKeyMapping":
[{
@metalefty
metalefty / gist:3d69807625558bab36b3e8e89f8c0db3
Created October 12, 2017 02:27
unlock softether radius
--- src/Cedar/Server.c.orig 2017-10-12 11:08:12.177671000 +0900
+++ src/Cedar/Server.c 2017-10-12 11:09:50.287845000 +0900
@@ -115,12 +115,12 @@
static SERVER *server = NULL;
static LOCK *server_lock = NULL;
-char *SERVER_CONFIG_FILE_NAME = "@vpn_server.config";
-char *SERVER_CONFIG_FILE_NAME_IN_CLIENT = "@vpn_gate_svc.config";
-char *SERVER_CONFIG_FILE_NAME_IN_CLIENT_RELAY = "@vpn_gate_relay.config";
-char *BRIDGE_CONFIG_FILE_NAME = "@vpn_bridge.config";
@metalefty
metalefty / xrdp_clean_sockets.sh
Last active April 8, 2019 03:29
Clean up remained xrdp socket files
#!/bin/sh
SOCKDIR=/tmp/.xrdp
SESSIONS=$(cd ${SOCKDIR} ; ls -1 xrdp_* | sed -e 's|[^0-9]||g' | sort -u)
for i in ${SESSIONS}
do
if [ ! -S ${SOCKDIR}/xrdp_display_${i} ]
then
(