Skip to content

Instantly share code, notes, and snippets.

View nazfox's full-sized avatar
🌸

彩桜なづな nazfox

🌸
View GitHub Profile
@nazfox
nazfox / gist:994f5defca8561dcdbb9fa8fc5a71672
Created March 26, 2023 04:23
エスケープ文字列`\"`を含む`"`で囲われた文字列とマッチする正規表現
function split_values() {
local fpat='([^,]+)|([[:space:]]*\"(\\\\.|[^\\\\"])*\"[[:space:]]*)'
echo "$1" | awk -vFPAT="${fpat}" '{for(i=1;i<=NF;i++){print $i}}'
}
@nazfox
nazfox / doppel_old
Created March 23, 2023 12:06
供養
#!/usr/bin/env bash
readonly DOPPEL_VER="0.0.1"
readonly DOPPEL_ROOT="${DOPPEL_ROOT:-"${HOME}/.doppel"}"
# These messages were generated by ChatGPT
readonly DOPPEL_SUCCES_MESSAGES=(
"Your project has been generated, time to fire up the coffee machine and get coding!"
"Project generation complete. Time to caffeinate and conquer some code!"
// C++ template for AtCoder created by nazfox
#include <functional>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <bitset>
#include <stdexcept>
#include <string>
#include <vector>
@nazfox
nazfox / bd-play.sh
Last active August 14, 2022 06:40
Play Blu-ray using HDMI Capture Device
#!/bin/bash
# video device list: `v4l2-ctl --list-devices`
# audio device list: `pacmd list short sources`
video_device='your video device name'
audio_device='your audio device name'
video_device_path=$(v4l2-ctl --list-devices | grep -A1 "$video_device" | tail -n1 | sed 's/^[ \t]*//')
@nazfox
nazfox / generate_keyframes.py
Created May 8, 2022 05:16
keyframeを自動生成するスクリプト
#!/bin/env python
def ease_in_out_quad(x):
if x < 0.5:
return 2 * x * x
else:
return 1 - pow(-2 * x + 2, 2) / 2
n_step = 50
n_sway = 2
@nazfox
nazfox / build.sh
Last active March 6, 2022 05:40
テンプレートファイルにテーマファイルを挿入するやつ sedとか使いたかったけど結局ループになった
#!/bin/bash
theme="$1"
template="./template.yml"
output="./alacritty.yml"
if [[ ! -f $template ]]; then
echo "template file does not exists." 1>&2
exit 1
import torch
from torch import nn
class BaseCouplingLayer(nn.Module):
def __init__(self, mask, m):
super().__init__()
self.mask = mask
self.m = m
#!/usr/bin/bash
#===========================================================
#
# This is a task runner.
# To learn how to use this, try running `./task help` first.
#
#===========================================================
@nazfox
nazfox / pipenv-and-python-invoke.sh
Last active February 20, 2022 09:52
Using the invoke task runner from a shell script. The command name displayed in the help message of invoke becomes this shellscript filename.
#!/usr/bin/bash
install_stamp=".install.stamp"
ver="0.1.0"
function find_command() {
type $1 > /dev/null 2>&1
}
function pipenv_error() {
@nazfox
nazfox / makefile-example
Created February 20, 2022 03:15
色々書いたけど使わなくなったので供養
##################################################
# GLOBALS
##################################################
LOG_DIR = ./log/
SCRIPT_DIR = ./src/scripts/
NOTEBOOK_DIR = ./notebooks/
FIND_COMMAND = $(SCRIPT_DIR)/find-command.sh
MAKEFILE_USAGE = $(SCRIPT_DIR)/makefile-usage.sh