Skip to content

Instantly share code, notes, and snippets.

View hartmut-co-uk's full-sized avatar

Hartmut hartmut-co-uk

View GitHub Profile
@hartmut-co-uk
hartmut-co-uk / toggle_chrome.sh
Last active October 4, 2021 18:49
Script to Toggle Chrome Process-State (STOP|CONT)
#!/bin/bash
# Copyright 2016 Hartmut Armbruster <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@hartmut-co-uk
hartmut-co-uk / QHalt.APPLESCRIPT
Last active October 4, 2021 18:49
AppleScript to shutdown / halt QNAP NAS (macOS Automator)
### AppleScript to shutdown / halt QNAP NAS
# requires pub-key access to QNAP setup for current user...
# [https://wiki.qnap.com/wiki/SSH:_How_To_Set_Up_Authorized_Keys]
tell application "Terminal"
set currentTab to do script ("ssh qnap halt;")
end tell
# Note: Using Mac OS 'Automator' it's easy to create a QHalt.app
@hartmut-co-uk
hartmut-co-uk / QWake.sh
Created January 15, 2017 10:18
Script to wakeup QNAP NAS (macOS Automator)
#!/bin/bash
### Script to wakeup QNAP NAS (well not much script there.. mostly to use via Automator)
# requires 'wakeonlan' (installed via Homebrew -> 'brew install wakeonlan')
/usr/local/bin/wakeonlan {{NAS_MAC1}}
### optional: 2nd eth adapter..
#/usr/local/bin/wakeonlan {{NAS_MAC2}}
@hartmut-co-uk
hartmut-co-uk / RouterPagination.vue
Last active October 5, 2021 03:58
SSR supporting nuxt pagination vue component, pagination as links (`nuxt-link` -> vue-router) & query params (configurable param names). Data/API loading paginated results is done via nuxt `fetch` & `watchQuery`.
<template>
<div class="pagination">
<div class="inner">
<template v-if="showPrev">
<nuxt-link v-if="prev" :to="routeToPage(prev)" class="page previous">Previous</nuxt-link>
<span v-else class="page previous disabled">Previous</span>
</template>
<template v-for="it in prevPages">
<nuxt-link v-if="it !== -1" :key="it" :to="routeToPage(it)" class="page">{{ it }}</nuxt-link>
<span v-else :key="it" class="page more">...</span>
@hartmut-co-uk
hartmut-co-uk / hartmut.zsh-theme
Created November 24, 2021 15:49
my custom zsh theme
if [ "$USERNAME" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="blue"; fi
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
PROMPT='%{$fg_bold[cyan]%}[%D{%H:%M:%S}]%{$reset_color%} %{${fg_bold[green]}%}%3~ $(git_prompt_info)%{${fg_bold[$CARETCOLOR]}%}»%{${reset_color}%} '
RPS1="${return_code}"
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[red]%}‹"
ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}"
@hartmut-co-uk
hartmut-co-uk / settings.json
Created June 5, 2022 10:33 — forked from danielroe/settings.json
VScode settings for a minimal UI
{
// Disable telemetry
"telemetry.telemetryLevel": "off",
// Zen mode
"zenMode.fullScreen": false,
"zenMode.hideTabs": true,
"zenMode.centerLayout": false,
// Theming
"workbench.iconTheme": "city-lights-icons-vsc",
"editor.fontFamily": "Dank Mono",