Skip to content

Instantly share code, notes, and snippets.

View kow08absty's full-sized avatar

Kohei OKUMURA kow08absty

  • Japan
View GitHub Profile
@kow08absty
kow08absty / 99bootcode
Created May 24, 2021 07:22
bootcode.bin checker for RaspberryPi booting with PXE
# place this at /etc/apt/apt.conf.d/99bootcode
DPkg::Post-Invoke { '/usr/local/sbin/bootcode-backup.sh'; };
@kow08absty
kow08absty / wsl2-startup.bat
Last active March 23, 2021 03:33
Auto Assign IPv4 for WSL2
@echo off
setlocal
@REM network adapter name to search by `ipconfig` command
set "VETH_SUFFIX=vEthernet (WSL)"
@REM IPv4 last octet using on WSL
set OCTET4=10
@REM target network device on WSL
set "DEV_NAME=eth0"
#!/usr/bin/python3
__author__ = "kow08absty <kow080816@gmail.com>"
__version__ = "1.0"
__date__ = "17 July 2020"
from RPi import GPIO
import time
import os
import argparse
@kow08absty
kow08absty / wpservice
Last active April 5, 2021 04:57
WordPress service shorthand
#!/bin/bash
if [ "$(whoami)" != 'root' ]; then
echo "required root"
exit 1
fi
usage() {
cat<<EOL
Usage: ${0} (start|stop|status|restart)
function Write-BranchName {
$branch = git rev-parse --abbrev-ref HEAD
$can_parse_rev = $?
git remote -v > $null
if($?){
if(!$can_parse_rev){
# we'll end up here if we're in a newly initiated git repo
Write-Host "(new repo) " -NoNewline -ForegroundColor Cyan
@kow08absty
kow08absty / publisher.gradle
Last active June 5, 2019 23:53
Gradle script for configuring to publish artifact using Artifactory
/**
* to load this script
* below android{} closure
apply from: '../publisher.gradle'
*/
import java.nio.file.Paths
import java.util.regex.Matcher
import java.util.regex.Pattern
@kow08absty
kow08absty / etc-bash_completion.d-wol.bash
Last active August 21, 2019 17:34
Wake on LAN Utility
#!/bin/bash
# sudo apt install bash-completion
# sudo cp etc-bash_completion.d-wol.bash /etc/bash_completion.d/wol.bash
_wol() {
local _cur="${COMP_WORDS[COMP_CWORD]}"
COMPREPLY=( $(compgen -W "$(wol --list)" -- "$_cur") )
}
@kow08absty
kow08absty / .bashrc
Last active October 6, 2025 07:29
customized resource files
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
@kow08absty
kow08absty / mdadm-resync-all
Last active May 25, 2019 11:57
Change state to 'check' for all md device
#!/bin/bash
if [ $(whoami) != 'root' ]; then
echo Requires root.
exit 1;
fi
if ls /sys/block/md[0-9]*/md/sync_action &> /dev/null; then
for path in /sys/block/md[0-9]*/md/sync_action; do
if [ $(cat "$path") = 'idle' ]; then
@kow08absty
kow08absty / check-and-mount
Last active June 3, 2020 02:04
[systemd service] Check and Mount /etc/fstab for network fs(cifs, nfs)
#!/bin/bash
TARGET='/etc/fstab'
DESCRIPTOR='<#--#>'
if [ $(whoami) != 'root' ]; then
echo 'Required root.'
exit 1
fi