Skip to content

Instantly share code, notes, and snippets.

View musaprg's full-sized avatar
🐱
meow meow

Kotaro Inoue musaprg

🐱
meow meow
View GitHub Profile
@musaprg
musaprg / keybindings.json
Created July 25, 2023 03:56
Ctrl+nでexplorerをトグルするようにすることでVimのnerdtreeと使い勝手を統一するやつ
// Place your key bindings in this file to override the defaults
[
{
"key": "ctrl+e",
"command": "-workbench.action.quickOpen"
},
{
"key": "ctrl+e",
"command": "-workbench.action.quickOpenNavigateNextInFilePicker",
"when": "inFilesPicker && inQuickOpen"
@musaprg
musaprg / sync-annict-epgstation.sh
Created June 25, 2023 03:37
AnnictとEPGStationの録画予約を同期するscript(cronにそのまま突っ込むためのやつ)
#!/bin/bash
set -eu
# You need to install annict-epgstation-connector first.
# $ brew tap musaprg/tap
# $ brew install annict-epgstation-connector
ANNICT_API_TOKEN=put-your-annict-token-here
@musaprg
musaprg / main.zig
Last active March 11, 2023 18:04
http client test with zig on master channel
const std = @import("std");
const heap = std.heap;
const http = std.http;
const Uri = std.Uri;
const debug = std.debug;
pub fn main() anyerror!void {
var arena = heap.ArenaAllocator.init(std.heap.page_allocator);
defer arena.deinit();
const allocator = arena.allocator();
@musaprg
musaprg / action.js
Created February 23, 2023 08:53
Auth0 Action for the Discord Guild Member Authorization
const { Client, Intents } = require('discord.js');
/**
* Handler that will be called during the execution of a PostLogin flow.
*
* @param {Event} event - Details about the user and the context in which they are logging in.
* @param {PostLoginAPI} api - Interface whose methods can be used to change the behavior of the login.
*/
exports.onExecutePostLogin = async (event, api) => {
const identities = event.user.identities.filter((v) => { return v.connection == "discord"; });
const std = @import("std");
const os = std.os;
const fs = std.fs;
const fmt = std.fmt;
const heap = std.heap;
const ArenaAllocator = heap.ArenaAllocator;
const linux = os.linux;
const print = std.debug.print;
// no interface natively in zig for now
@musaprg
musaprg / main.zig
Created July 25, 2022 15:00
親の顔より見たfork-exec
const std = @import("std");
const os = std.os;
const linux = os.linux;
const print = std.debug.print;
fn parent(_: usize) !void {
os.exit(0);
}
fn child() !void {
@musaprg
musaprg / gendiff
Created January 9, 2022 19:00
vX.Y.Zという命名規則でタグ付されているやつの新しいものとひとつ前のバージョンのlatexdiffをとってくれるくん
#!/bin/bash
git tag | sort -V | tail -n 2 | xargs -n 2 bash -c 'latexdiff-vc -e utf8 --git --flatten --force -r $0 -r $1 -t CFONT main.tex'
@musaprg
musaprg / notify_discord
Last active November 29, 2021 09:34
stdinの内容をDiscordに通知するくん
#!/bin/bash
set -euo pipefail
if [ -z "$DISCORD_WEBHOOK_URL" ]; then
echo '$DISCORD_WEBHOOK_URL is not set. Please set and try again.'
exit 1
fi
if [ -t 0 ]; then
@musaprg
musaprg / benchexec
Last active November 27, 2021 09:44
本当はsudo使った方がいいけど諸事情によりsuしか使えない時にCPU-scalingを切ってベンチマークを回す君
#!/bin/bash
set -eu
if [ $# -lt 1 ]; then
echo "Usage: benchexec <your command>"
exit 1
fi
echo "Input your root password to change the CPU governor for disabling CPU-scaling."