Skip to content

Instantly share code, notes, and snippets.

View amekusa's full-sized avatar
🏠
Working from home

amekusa amekusa

🏠
Working from home
View GitHub Profile
@amekusa
amekusa / Iterate over key-value array.sh
Last active April 21, 2023 07:51
Iterate over key-value array in bash
arr=(
name="John Doe"
age=32
job="Software Engineer"
)
for each in "${arr[@]}"; do
key="${each%%=*}"
val="${each:$((${#key}+1))}"
echo "$key: $val"
@amekusa
amekusa / google_en_us.xml
Last active February 7, 2023 15:44
Google (en-US) Search Plugin
<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"
xmlns:moz="http://www.mozilla.org/2006/browser/search/">
<!-- Created on Tue, 07 Feb 2023 15:27:53 GMT -->
<ShortName>Google (en-US)</ShortName>
<Description>search?q={searchTerms}&amp;hl=en&amp;gl=US&amp;pws=0</Description>
<Url type="text/html" method="get" template="https://www.google.com/search?q={searchTerms}&amp;hl=en&amp;gl=US&amp;pws=0"/>
<Url type="application/x-suggestions+json" template="http://suggestqueries.google.com/complete/search?output=firefox&amp;client=firefox&amp;q={searchTerms}&amp;hl=en&amp;gl=US&amp;pws=0"/>
<!-- <Image width="16" height="16">GENERATEDLATER</Image> -->
<Developer>amekusa</Developer>
@amekusa
amekusa / css-positioning.html
Last active January 31, 2023 05:53
oddities of `position` property
<!DOCTYPE html>
<html>
<body>
<style>
body {
background: yellow;
}
div {
min-height: 100px;
@amekusa
amekusa / rkhunter.1.4.6-2.patch
Created October 23, 2022 14:12
Fixing grep/egrep warnings in Rkhunter 1.4.6
--- rkhunter.1.4.6-2 2022-10-23 17:19:51.000000000 +0900
+++ rkhunter.1.4.6-2.patched 2022-10-23 23:07:17.000000000 +0900
@@ -1,5 +1,8 @@
#!/bin/sh
+# This is PATCHED version of rkhunter 1.4.6-2 to eliminate grep and egrep warnings.
+# Diff vs the original: https://github.com/amekusa/arch-setup/compare/825d7ac..b2aceeb
+
#
# rkhunter -- Scan the system for rootkits and other known security issues.
@amekusa
amekusa / LLVM on High Sierra.md
Last active September 18, 2024 04:28
Notes for installing/updating LLVM on macOS High Sierra

Installing/Updating LLVM on macOS High Sierra

Updated: 2023-03-19


Installing LLVM (14)

brew install --debug llvm@14
...
 - raise
@amekusa
amekusa / vbox-create.sh
Last active October 13, 2022 10:54
Creating a VirtualBox VM via terminal
VBoxManage createvm --name MyVM --ostype ArchLinux_64 --basefolder "$HOME/VirtualBox VMs" --register
# NOTE:
# To show available --ostype values:
# VBoxManage list ostypes
@amekusa
amekusa / iptables-test.sh
Last active June 29, 2022 03:51
Learn how iptables actually works by testing by yourself
#!/bin/bash
# NOTE:
#
# To run (DO NOT RUN on your production server):
# sudo ./iptables-test.sh
#
# To test:
# ping -c 1 <ip address>
#
cd /srv/http

# set owner to you
sudo chown -R you example1.com example2.com

# set group to http
sudo chgrp -R http example1.com example2.com
sudo chmod g+s example1.com example2.com
@amekusa
amekusa / mac-wifi-monitor.sh
Last active September 26, 2021 21:16
Mac WiFI Monitor; A bash script that keeps checking if the WiFi connection alive on your Mac by continuously sending pings to the router and public DNSes. If the connection seemed lost nonetheless, the script automatically restarts the WiFi adapter.
#!/bin/bash
# Mac WiFi Monitor
# ------------------ ---- -- -
# Keeps checking if the WiFi connection alive
# by continuously sending pings to the router and public DNSes.
# If the connection seemed lost nonetheless,
# automatically restarts the WiFi device on your Mac
# ====================================================
# Author: amekusa.com
/**
* Extensible Function
* @update 2021-07-26
*/
class Callable extends Function {
constructor() {
super('...args', 'return this.__self.__call(...args)');
this.__self = this.bind(this);
return this.__self;
}