View pacman-auto-update.service
# Download new packages but don't install them
# Save in /etc/systemd/system/
[Unit]
Description=Pacman Automatic Download (no install) service
After=network-online.target
[Service]
# Wait time if process hangs
TimeoutStopSec=5m
View nvidia-driver-install.ps1
# Install nVidia drivers without extra stuff
#
# Extract nvidia 385.69-desktop-win10-64bit-international-whql.exe to a directory and run:
# ./this-script.ps1 385.69-desktop-win10-64bit-international-whql
#
# (c) Pekka Järvinen 2017-
param (
[Parameter(Mandatory=$true)][string]$unpackDir
)
View windows-advanced-power-settings-to-markdown.ps1
# List Windows advanced power settings as MarkDown
# Use:
# this-script.ps1 | Out-File power.md
# Use powercfg to show hidden settings:
# powercfg -attributes <Group GUID> <GUID> -ATTRIB_HIDE
# example:
# powercfg -attributes 54533251-82be-4824-96c1-47b60b740d00 06cadf0e-64ed-448a-8927-ce7bf90eb35d -ATTRIB_HIDE
# (c) Pekka "raspi" Järvinen 2017-
$powerSettingSubgroubTable = Get-WmiObject -Namespace root\cimv2\power -Class Win32_PowerSettingSubgroup | Where-Object {$_.ElementName -ne $null}
View enable-all-advanced-power-settings.ps1
# List all possible power config GUIDs in Windows
# Run: this-script.ps1 | Out-File powercfg.ps1
# Then edit and run powercfg.ps1
# (c) Pekka "raspi" Järvinen 2017
$powerSettingTable = Get-WmiObject -Namespace root\cimv2\power -Class Win32_PowerSetting
$powerSettingInSubgroubTable = Get-WmiObject -Namespace root\cimv2\power -Class Win32_PowerSettingInSubgroup
Get-WmiObject -Namespace root\cimv2\power -Class Win32_PowerSettingCapabilities | ForEach-Object {
$tmp = $_.ManagedElement
View rm_files_by_dir.py
#!/bin/env/python
# -*- encoding: utf8 -*-
# usage: script.py --file my_filelist.txt --directory /mnt/storage/
# (c) Pekka Järvinen 2017-
import logging
import os
import sys
from argparse import ArgumentParser
View mv_one_file_to_parent.py
#!/bin/env/python
# -*- encoding: utf8 -*-
# Move file to parent directory if it's the only one there including sub-directories.
# usage: script.py <directory>
# script.py /stuff/files/
import os
import sys
from shutil import move
View esxi_lldp_control.sh
#!/bin/sh
# Enable/Disable LLDP on vSwitch ports on VMWare ESXi
# Tested with ESXi 6.0.0 3620759
# Doesn't need vCenter, only SSH access to the ESXi machine
# (c) Pekka "raspi" Jarvinen 2016 http://raspi.fi/
SWITCH=$1
OPERATION=$2
if [ "$SWITCH" = "" ] || [ "$OPERATION" = "" ]; then
View RemoteMachineSetup.md

Environment

  • All machines are local
  • Multiple cheap "stupid" viewer client machines
  • One hypervisor which is used by these client machines

Techs

  • RDP
  • VNC
  • PCoIP
  • Direct video stream
View finnish_vatnum_check.py
def is_vatnum(num):
if len(num) > 9:
return False
if "-" not in num:
return False
n,check = num.split("-")
try:
View gettext_update.sh
#!/bin/bash -e
# generate file list
echo -e "" > files.txt
find ../application -type f \( -iname "*.php" -or -iname "*.phtml" \) -exec readlink -f "{}" \; > files.txt
# scan files
xgettext --force-po --add-comments --from-code=UTF-8 --language=php --package-name=app --package-version=1.0 --msgid-bugs-address=noreply@example.com -o base.pot -f files.txt
# base pot -> <lang>.po update