Skip to content

Instantly share code, notes, and snippets.

View u1-liquid's full-sized avatar
👋
手を振る

まっちゃとーにゅ u1-liquid

👋
手を振る
View GitHub Profile
CREATE OR REPLACE FUNCTION base36_decode(IN base36 varchar)
RETURNS bigint AS $$
DECLARE
a char[];
ret bigint;
i int;
val int;
chars varchar;
BEGIN
chars := '0123456789abcdefghijklmnopqrstuvwxyz';
@u1-liquid
u1-liquid / gist:d0e420cf8c8684ed95f6406d4683172f
Created December 25, 2023 21:06
Find IPv4 from Filesystem
#!/bin/sh
# https://unix.stackexchange.com/a/522127
cat /proc/net/fib_trie | awk '/32 host/ { print f } {f=$2}' | sort | uniq | grep -v 127.0.0.1
@u1-liquid
u1-liquid / Set-DNS-DoH.ps1
Last active December 22, 2023 01:16
Set DNS servers
#Requires -RunAsAdministrator
Write-Output "Update DoH settings ..."
$baseRegistryPath = "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters"
if (Test-Path $baseRegistryPath) {
Remove-Item -Path $baseRegistryPath -Recurse -Force 2>&1 | Out-Null
}
$adapters = Get-NetAdapter -IncludeHidden | Where-Object {$_.Status -ne 'Not Present'}
#!/bin/bash
apt-get update
dpkg --get-selections | grep deinstall | awk '{print $1}' | xargs apt-get --yes purge
apt-get --yes --ignore-hold --with-new-pkgs --allow-change-held-packages upgrade
apt-get --yes --ignore-hold --allow-change-held-packages dist-upgrade
apt-get --yes --purge autoremove
dpkg --get-selections | grep deinstall | awk '{print $1}' | xargs apt-get --yes purge
# vmware-modconfig --console --install-all
@u1-liquid
u1-liquid / parseDateTime.java
Created August 8, 2023 10:46
Universal DateTime Pattern
private static final DateTimeFormatter universalDateTimePattern = DateTimeFormatter.ofPattern("[y-M-d[[' ']['T'][H[:m[:s[.SSSSSS][.SSS][.S]]]][' '][VV][zzz][OOOO][XXXXX]]][H[:m[:s[.SSSSSS][.SSS][.S]]]]");
public static ZonedDateTime parseDateTime(String dateTime) {
try {
TemporalAccessor temporal = universalDateTimePattern.parseBest(dateTime, ZonedDateTime::from, OffsetDateTime::from, LocalDateTime::from, LocalDate::from, LocalTime::from);
if (temporal instanceof ZonedDateTime) return (ZonedDateTime) temporal;
else if (temporal instanceof OffsetDateTime) return ((OffsetDateTime) temporal).atZoneSameInstant(ZoneId.systemDefault());
else if (temporal instanceof LocalDateTime) return ((LocalDateTime) temporal).atZone(ZoneId.systemDefault());
else if (temporal instanceof LocalDate) return ((LocalDate) temporal).atStartOfDay(ZoneId.systemDefault());
else if (temporal instanceof LocalTime) return ((LocalTime) temporal).atDate(LocalDate.now()).atZone(ZoneId.systemDefault());
@u1-liquid
u1-liquid / meilisearch-cleanup-tasks.service
Created June 28, 2023 07:19
Cleanup Meilisearch Tasks Database Weekly with Systemd-Timer
[Unit]
Description=Cleanup Meilisearch Tasks Database
After=meilisearch.service
[Service]
Type=oneshot
ExecStart=curl -v -H 'Authorization: Bearer MASTER_KEY' -X DELETE 'http://127.0.0.1:7700/tasks?statuses=failed,canceled,succeeded'
User=meilisearch
Group=meilisearch
#━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
# Misskey configuration
#━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
# ┌─────┐
#───┘ URL └─────────────────────────────────────────────────────
# Final accessible URL seen by a user.
url: https://127.0.0.1:8001
#━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
# Misskey configuration
#━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
# ┌─────┐
#───┘ URL └─────────────────────────────────────────────────────
# Final accessible URL seen by a user.
url: https://alice.local
@u1-liquid
u1-liquid / gist:c26745c55dd64e6404dd4ece6c44f722
Last active May 11, 2020 13:43
旧バージョンのブラウザをkrs
(http.user_agent contains "Mozilla/1.") or
(http.user_agent contains "Mozilla/2.") or
(http.user_agent contains "Mozilla/3.") or
(http.user_agent contains "Mozilla/4.") or
(http.user_agent contains "Safari/1") or
(http.user_agent contains "Safari/2") or
(http.user_agent contains "Safari/3") or
(http.user_agent contains "Safari/4") or
(http.user_agent contains "Safari/50") or
(http.user_agent contains "Safari/51") or
# If you have any doubts about what a setting does,
# check https://docs.funkwhale.audio/configuration.html#configuration-reference
FUNKWHALE_API_IP=127.0.0.1
FUNKWHALE_API_PORT=5001
FUNKWHALE_WEB_WORKERS=2
FUNKWHALE_HOSTNAME=sound.iro.moe
FUNKWHALE_PROTOCOL=https
EMAIL_CONFIG=smtp+tls://funkwhale%40iro.moe:***@smtp.mailgun.com:587