Skip to content

Instantly share code, notes, and snippets.

View metzenseifner's full-sized avatar

Jonathan Lee Komar metzenseifner

  • The Alps
View GitHub Profile
@metzenseifner
metzenseifner / excel_column_sequence_row_by_row.scpt
Last active June 9, 2017 06:00
Excel Selection Column Sequence Row by Row
tell application "Microsoft Excel"
set screen updating to false -- optimize performance
set range_selected to selection
-- setup ref vars for selection
tell selection to set {range_selected_row_index, range_selected_column_index, range_selected_row_count, range_selected_column_count} to {get first row index of selection, get first column index of selection, get count rows of selection, get count columns of selection}
-- go column by column and iterate each row in each column
repeat with column_step from range_column_index to range_column_count -- column iteration
@metzenseifner
metzenseifner / pi3-x-screen-blank
Created May 14, 2017 08:29
Disable Screen Blanking
xset -display :0.0 -dpms # disable Energy Star (DPMS) features (+dpms enables them)
xset -display :0.0 s blank # screen-saver control {blank,noblank,off}
@metzenseifner
metzenseifner / pi3-analog-volume-max.sh
Last active May 12, 2017 06:44
Set Analog Volume to Maximum
# Assumes you installed pacman -S alsa-utils
/usr/bin/amixer set 'PCM' 100% unmute
@metzenseifner
metzenseifner / pi3-analog-audio.sh
Last active August 15, 2021 12:54
Force Analog Audio on Raspberry Pi 3
#!/usr/bin/sh
echo "dtparam=audio=on" >> /boot/config.txt
echo "audio_pwm_mode=2" >> /boot/config.txt
echo "disable_audio_dither=1 # remove analog audible background hiss at low volume (did not work for me)" >> /boot/config.txt
echo "#hdmi_drive=1 # 1: DVI (no sound) 2: HDMI (sound if supported and enabled)" >> /boot/config.txt
echo "#amixer cset numid=3 1 # Did not work for me 0=auto 1=analog 2=HDMI (careful, number directly after = should be 2)" >> /boot/config.txt
echo "# Force analog audio" >> /boot/config.txt
echo "hdmi_ignore_edid_audio=1" >> /boot/config.txt
@metzenseifner
metzenseifner / kodi.service
Created May 8, 2017 14:58
Kodi Unit File
[Unit]
Description = Kodi Media Center
# if you don't need the MySQL DB backend, this should be sufficient
After = systemd-user-sessions.service network.target sound.target
# if you need the MySQL DB backend, use this block instead of the previous
# After = systemd-user-sessions.service network.target sound.target mysql.service
# Wants = mysql.service
@metzenseifner
metzenseifner / raspberrypi3_setup.sh
Last active May 3, 2017 12:36
Setup Raspberry Pi 3 from Arch Linux Tarball
# Setup Raspberry Pi 3 from Arch Linux Tarball
# Setup wlan wpa_supplicant conf
#WLANSSID=""
#WLANPASSWD=""
echo "network={\n ssid=$WLANSSID\n $WLANPASSWD\n}" > /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
systemctl enable [email protected]
systemctl start [email protected]
[Unit]
Description = Start instance of desktop environment on tty1/vt1
After=systemd-user-sessions.service network.target sound.target
[email protected]
[Service]
User = jonathan
Group = admin
PAMName = login
Type = simple
@metzenseifner
metzenseifner / iptables-internet-sharing.sh
Last active May 12, 2017 05:34
iptables script for internet connection sharing
#!/bin/sh
# Shares wifi with bridge device. You could also use a physical eth device, or just bind any other phy. device to bridge.
# This assumes you setup a network device called br0 and your wlan device is called wlan0. I just used systemd-networkd files
# under /etc/systemd/network. You also need to setup a DNS server on br0. I used dnsmasq as my DNS and DHCP server with "interface=br0" and
# "dhcp-range=192.168.4.50,192.168.4.150,12h" in the config /etc/dnsmasq.conf. Your br0 should correspond to subnet mask in dnsmasq.conf
# in my case "192.168.4.1
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
echo "Not running as root"
@metzenseifner
metzenseifner / lightdm.conf
Last active March 15, 2017 10:22
LightDM configuration in conjunction with TigerVNC
# Enable the X Display Manager Control Protocol Server
[XDMCPServer]
enabled=true
port=177
# Set start-default-seat to false to allow lightdm to run in the background
[LightDM]
start-default-seat=false
@metzenseifner
metzenseifner / xvnc.socket
Last active March 15, 2017 09:51
TigerVNC Server Socket
# make sym link from /etc/systemd/system/xvnc.socket
# to /etc/systemd/system/socket.target.wants to enable
[Unit]
Description=XVNC Server
[Socket]
ListenStream=5900
Accept=yes