Skip to content

Instantly share code, notes, and snippets.

@agail
agail / w32tm.sh
Last active September 28, 2021 12:30
NT epoch to Linux epoch converter
#!/bin/bash
#
# Most versions of Unix, for example, use January 1, 1970 (1970-01-01 00:00:00) as the epoch date
# Windows uses January 1, 1601 (1601-01-01 00:00:00)
# Macintosh systems use January 1, 1904 (1904-01-01 00:00:00)
# Digital Equipment Corporation's Virtual Memory System (VMS) uses November 17, 1858 (1858-11-17 00:00:00)
offset=$((134774*24*60*60)) # number of days from Jan 1st 1601 to Jan 1st 1970 (incl leap year days), converted to seconds
timestamp=$1 # windows timestamp
format=$2
@agail
agail / themes.sh
Created August 23, 2021 19:27
Simple script to change the theme of Script-Server
#!/bin/bash
#
# version: 0.1
# description: simple script to change the theme of Script Server
# prerequisites: script server 1.17.0 or later
# within container, create /app/conf/theme/
# theme naming example, theme.my_theme_name.css
#
# source: https://github.com/bugy/script-server/issues/324#issuecomment-751253715
#
@agail
agail / scriptserver-docker.md
Last active March 28, 2023 07:20
Quick start Script-server Docker

Intro

Quick way to get started with Script-Server docker

### directories ###
 ssdir=script-server
 mkdir -p /opt/${ssdir}/conf /opt/${ssdir}/runners /opt/${ssdir}/scripts /opt/${ssdir}/conf/theme
### conf.json ###
@agail
agail / themes.sh
Created August 13, 2021 21:21
Simple theme switcher for script server
#!/bin/bash
#
# version: 0.1
# description: simple script to change the theme of Script Server
# prerequisites: script server 1.17.0 or later
# w/i container, create /app/conf/theme/
# theme naming example, theme.my_theme.css
#
# source: https://github.com/bugy/script-server/issues/324#issuecomment-751253715
#
@agail
agail / local-proxy-pac.md
Created August 4, 2021 20:51
Load local proxy.pac file chrome/chromium
chrome|chromium --proxy-pac-url='data:application/x-javascript-config;base64,'$(base64 -w0 /path/to/local/proxy.pac)

source: https://superuser.com/a/1596133
@agail
agail / docker-add-volume.md
Last active June 9, 2023 12:51
Add docker volume to running container

Source: https://stackoverflow.com/questions/28302178/how-can-i-add-a-volume-to-an-existing-docker-container#comment98804407_53516263

* docker ps --no-trunc --format 'table {{.ID}}\t{{.Names}}'      # list running containers and their id's
* cd /var/lib/docker/containers/<container id>                   # cd to desired container
* systemctl stop docker.service                                  # otherwise changes will be overwritten when re-starting
* vim <(jq . config.v2.json)                                     # prettify json and load it into vim / vi
* :/MountP                                                       # search for MountPoints

 "MountPoints": {
@agail
agail / citrix-alt+tab.cmd
Created June 17, 2021 09:57
Citrix Alt+tab - Windows
@echo off
::
:: v0.1 - initial version
::
SetLocal
set HKCU=HKEY_CURRENT_USER\SOFTWARE\Citrix\ICAClient\Engine\Lockdown Profiles\All Regions\Lockdown\Virtual Channels\Keyboard
set HKLM32=HKEY_LOCAL_MACHINE\SOFTWARE\Citrix\ICA Client\Engine\Lockdown Profiles\All Regions\Lockdown\Virtual Channels\Keyboard
set HKLM64=HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Citrix\ICA Client\Engine\Lockdown Profiles\All Regions\Lockdown\Virtual Channels\Keyboard
set Key=TransparentKeyPassthrough
@agail
agail / ica-customize.sh
Created May 20, 2021 09:41
Customization of icaclient settings (All_Regions.ini)
#!/bin/bash
#
# version: 0.1 (Initial script)
#
# v0.1 - Enable ALT+TAB on remote session - https://support.citrix.com/article/CTX232298
_allregions_ini=/etc/icaclient/config/All_Regions.ini
f_check_ini () {
if [ ! -f ${_allregions_ini} ]; then
@agail
agail / gdm-favorites.sh
Created April 19, 2021 19:55
Manage Gnome3 favorites (add, list remove)
#!/bin/bash
#
# List / add / remove application favourites to gnome3
# Works with Ubuntu 18.04, 20.04 LTS
#
opt=($*)
favourites="/org/gnome/shell/favorite-apps"
add () {
@agail
agail / mirror-openwrt-repo.sh
Last active March 9, 2021 21:33
Mirror openwrt repo
#!/bin/bash
#
# version: 1.12
# description: reads Packages.gz and download ipk and checks md5sum
# purpose: archive.openwrt.org have had several uptime issues, last some disk issues
# since it acts as repo for older releases, it's better to be safe than sorry
# freifunk offers a cloned repo for [chaos calmer - 15.05.1]
#
# history: v1.00 - initial script
# v1.01 - fixed awk typo in f_parse_pkgz