Skip to content

Instantly share code, notes, and snippets.

View hapylestat's full-sized avatar
:octocat:
Looking for time compression tool

hapylestat

:octocat:
Looking for time compression tool
View GitHub Profile
@hapylestat
hapylestat / hide.cs
Created July 20, 2023 13:16
Switching Start Menu panne autohide option on or off
// To compile use:
// C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe .\hide.cs
//
using System;
using System.Runtime.InteropServices;
using System.Drawing;
namespace AppBar {
public enum AppBarMessages
{
@hapylestat
hapylestat / container_registry.conf
Last active November 30, 2022 04:48
NEXUS Docker reverse proxy via nginx
upstream nexus_registry {
server 10.236.0.5:20080 max_fails=3 fail_timeout=10s;
}
map $status $nexus_auth {
401 'Bearer realm="https://host:8888/v2/token",service="https://host:8888/v2/token"';
}
server {
listen 8888 ssl;
@hapylestat
hapylestat / __readme
Last active November 29, 2022 23:59
DDNS_Namecheap
How to
========
copy ddns.config /etc/default/
copy ddns.{service,timer} /etc/systemd/system/
echo "adjust ddns.config ..."
vi /etc/default/ddns.config
systemctl daemon-reload
systemctl enable ddns.timer
systemctl start ddns.timer
#!/bin/bash
# shellcheck disable=SC2155,SC2015,SC2183
unselectedColor="\033[38;05;188m"
selectedColor="\033[38;05;232;48;05;188m"
resetColor="\033[m"
moveCursor() {
curl https://gist.githubusercontent.com/hapylestat/1b2c3857c8e70ad5e9527a5152c881e1/raw/87972ed8c5943b9a269de128b532c5b3521fa023/disable_lvm_warnings.sh | bash -
#!/bin/bash
_sync(){
sync
echo 3 > /proc/sys/vm/drop_caches
}
DRIVE_MNT=/mnt/storages/$1
@hapylestat
hapylestat / make-cert.sh
Last active April 11, 2022 14:26
generate-proper-selfsigned-certs
#!/bin/bash
declare -A CNS=(
[domain]=cert_file_name
)
KEY_PATH=/etc/ssl/private
CERT_PATH=/etc/ssl/certs
#!/bin/bash
MYHOST=$1
openssl s_client -showcerts -connect ${MYHOST}:443 </dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > /etc/pki/ca-trust/source/anchors/nginx-selfsigned.crt
update-ca-trust; update-ca-trust extract
@hapylestat
hapylestat / text_menu.ps1
Created July 21, 2021 18:38
Powershell text based menu with arrows navigation
function moveCursor{ param($position)
$host.UI.RawUI.CursorPosition = $position
}
function RedrawMenuItems{
param ([array]$menuItems, $oldMenuPos=0, $menuPosition=0, $currPos)
# +1 comes from leading new line in the menu
# Remove sparce space from qcow image
# https://serverfault.com/questions/432119/is-there-any-way-to-shrink-qcow2-image-without-converting-it-raw
qemu-img convert -O qcow2 source.qcow2 shrunk.qcow2
# show progress bar for tar
# https://superuser.com/questions/168749/is-there-a-way-to-see-any-tar-progress-per-file
# note: it requires "pv" package to be installed
_folder=./folder