Skip to content

Instantly share code, notes, and snippets.

Avatar
😒
I may be slow to respond.

Crack Duck n1trux

😒
I may be slow to respond.
View GitHub Profile
@n1trux
n1trux / linux-gamecount.py
Created Apr 23, 2018
Count Linux games on SteamDB
View linux-gamecount.py
#!/usr/bin/python3
from lxml import html
import requests
gamecount = int(html.fromstring(requests.get('https://steamdb.info/linux/').content).xpath('//nav[@class="tabnav-tabs"]/*/span[@class="counter"]/text()')[0].replace(',',''))
print(gamecount)
@n1trux
n1trux / Discord
Created Jan 5, 2018
firejail profile for the Discord Electron "desktop" client
View Discord
# Firejail profile for Discord
# put this in ~/.config/firejail/
include /etc/firejail/Discord.local
# Persistent global definitions
include /etc/firejail/globals.local
include /etc/firejail/disable-common.inc
include /etc/firejail/disable-passwdmgr.inc
include /etc/firejail/disable-programs.inc
@n1trux
n1trux / update-globalipv6.bash
Created Oct 15, 2017
Bash update global IPv6 with afraid DNS
View update-globalipv6.bash
#!/bin/bash
globalIPv6=`ip addr show dev enp0s25 | sed -e 's/^.*inet6 \(2[^ ]*\)\/.*$/\1/;t;d'`
echo "global IPv6 is $globalIPv6"
wget -q --read-timeout=0.0 --waitretry=5 --tries=400 --background https://freedns.afraid.org/dynamic/update.php?KEYHERE
@n1trux
n1trux / toggle_automute.sh
Created May 21, 2017
toggle automute for specific alsa card
View toggle_automute.sh
#!/bin/sh
# card name
CARD=`sed -n 's/\s\([0-9]*\).*:\s.*Intel PCH/\1/p' /proc/asound/cards`
# check auto-mute state
amixer -c $CARD sget "Auto-Mute Mode" | grep "Item0: 'Disabled'"
# $? is 0 if auto-mute is disabled
# $? is 1 if auto-mute is enabled
if [ "$?" -eq "0" ]; then
@n1trux
n1trux / rotate_screen.sh
Last active May 21, 2017
x230 tablet scripts for rotating screen and disabling ultranav touchpad/trackpoint
View rotate_screen.sh
#!/bin/bash
# Find the line in "xrandr -q --verbose" output that contains current screen orientation and "strip" out current orientation.
rotation="$(xrandr -q --verbose | grep 'connected' | egrep -o '\) (normal|left|inverted|right) \(' | egrep -o '(normal|left|inverted|right)')"
# Using current screen orientation proceed to rotate screen and input devices.
# find the names for devices with xinput --list
case "$rotation" in
@n1trux
n1trux / runtime-install.txt
Created Oct 24, 2016
install runtimes available in choco
View runtime-install.txt
cinst adobeair
cinst vcredist2010
cinst vcredist2012
cinst vcredist2013
cinst vcredist2015
cinst javaruntime-preventasktoolbar
cinst jre8
cinst dotnetcore-runtime.install
cinst dotnet4.6.1
cinst gtk-runtime
@n1trux
n1trux / linux_lightsout.bash
Last active Jan 2, 2018
lightsout for linux (suspend when no network activity for 1 hour)
View linux_lightsout.bash
#!/bin/bash
########################################################################
# LIGHTS OUT FOR LINUX (lofl) #
# This script suspends the computer if it's idle for a given period of #
# time. It monitors network activity, logged on users and CPU load. #
########################################################################
# maximum packet count per minute – usually not more than 12-15
net_threshold=12
@n1trux
n1trux / service.sh
Created Aug 28, 2015
arch linux service wrapper
View service.sh
#!/bin/sh
###########################################################################
# /usr/bin/service
#
# A convenient wrapper for the /etc/init.d init scripts.
#
# This script is a modified version of the /sbin/service utility found on
# Red Hat/Fedora systems (licensed GPLv2+).
#
@n1trux
n1trux / asound.state
Created Aug 17, 2015
asound.state for Toshiba Chromebook 2 (CB30-B-104)
View asound.state
state.Intel {
control.1 {
iface CARD
name 'HDMI/DP,pcm=3 Jack'
value false
comment {
access read
type BOOLEAN
count 1
}