Skip to content

Instantly share code, notes, and snippets.

View mfakane's full-sized avatar

mfakane mfakane

View GitHub Profile
@mfakane
mfakane / keybase.md
Last active March 30, 2023 08:34
Keybase proof

Keybase proof

I hereby claim:

  • I am mfakane on github.
  • I am mfakane (https://keybase.io/mfakane) on keybase.
  • I have a public key ASBe-4DFcnP4z92y47ut8BzkM1RDw--0treUlgt83q346go

To claim this, I am signing this object:

@mfakane
mfakane / replace_email_address_placeholders.user.js
Last active February 23, 2023 23:35
User Script for generating email aliases
// ==UserScript==
// @name Generate random email address from placeholders
// @namespace https://github.com/mfakane
// @version 0.1
// @description Automatically replaces placeholders in email addresses during input. Intended to use with plus aliases (e.g. yourusernamehere+XXXX@gmail.com) or custom domains (e.g. HOSTNAME+XXXX@example.com)
// @author mfakane
// @match http://*/*
// @match https://*/*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
@mfakane
mfakane / MmdDrop.cs
Created October 21, 2012 06:15
自動ファイルドロップ
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Pipes;
using System.Linq;
using System.Runtime.InteropServices;
using System.Security;
using System.Text;
using System.Threading;
@mfakane
mfakane / GamePad.cs
Created August 28, 2011 11:15
ゲームパッドの取り扱い
// GamePad.GetAvailableGamePads() してインスタンスを取得してから
// Update() を呼び出してフレームごとに状態を更新しましょう。
// 状態を更新後 IsDown や IsUp でボタンとかを調べられます。前フレームとの取得結果を比較することで押した瞬間や離した瞬間と比較できるでしょう。
// ボタン指定とかが適当で使いづらいので要改善
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Security;
@mfakane
mfakane / FlipSelectedString.ahk
Created June 5, 2020 19:42
選択文字列を前後反転
^+r::
ClipSaved := ClipboardAll
Send ^c
ClipWait
Clipboard := Flip(Clipboard)
Send ^v
Clipboard := ClipSaved
ClipSaved =
Return
@mfakane
mfakane / discord.css
Created March 31, 2020 12:56
BetterDiscord 向けの、チャンネル一覧とメンバー一覧を折りたたんでマウスオーバーで展開するカスタム CSS
.sidebar-2K8pFh {
width: 64px;
transition: all 0.25s ease;
}
.sidebar-2K8pFh:hover {
width: 240px;
}
.panel-24C3ux, .container-3baos1, .container-1giJp5 {
padding-left: 16px;
@mfakane
mfakane / .nanorc
Created March 15, 2017 09:25
これが私の .nanorc
include "/usr/share/nano/*.nanorc"
set autoindent
set const
set cut
set morespace
#set mouse
set multibuffer
set nohelp
set nonewlines
@mfakane
mfakane / auto-poweroff.sh
Last active February 13, 2020 15:21
BRAVIA の HTTP API を使って外部信号入力がないときに自動電源オフ (HDMI 以外のことは全く考慮してないので注意)
#!/bin/sh
# Get external input states
input_statuses=$(./bravia-cmd.sh avContent getCurrentExternalInputsStatus 105 '[]' 1.1 | jq -c '.result[][]')
while IFS= read -r input; do
if [[ $(echo $input | jq -r '.status') = 'true' ]]; then
# When input signal is detected
uri=$(echo $input | jq -r '.uri')
current_input=$(./bravia-cmd.sh avContent getPlayingContentInfo 103 '[]' 1.0)
@mfakane
mfakane / betterlightdiscord.css
Created March 6, 2018 18:34
BetterDiscord 設定メニュー Light Theme 合わせ
.theme-light #bd-settingspane-container h2.ui-form-title,
.theme-light #bd-settingspane-container .ui-switch-item h3 {
color: #4f5f5c;
}
.theme-light #bd-settingspane-container .ui-switch-item .style-description {
color: hsla(218, 5%, 47% .6);
}
.theme-light #bd-settings-sidebar .ui-tab-bar-item {
@mfakane
mfakane / update-iptables.sh
Last active February 15, 2018 16:59
国による IP ブロック
#!/bin/bash
cd /tmp
curl -O http://nami.jp/ipv4bycc/cidr.txt.gz && gunzip -f cidr.txt.gz
ipset create -exist WHITELIST hash:net
ipset flush WHITELIST
sed -n 's/^JP\t//p' cidr.txt | while read ADDRESS; do ipset add WHITELIST $ADDRESS; done
ipset create -exist BLACKLIST hash:net