Skip to content

Instantly share code, notes, and snippets.

View n1trux's full-sized avatar
😒
I may be slow to respond.

Crack Duck n1trux

😒
I may be slow to respond.
  • DE
  • 15:25 (UTC +02:00)
View GitHub Profile
@n1trux
n1trux / linux-gamecount.py
Created April 23, 2018 05:55
Count Linux games on SteamDB
#!/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 January 5, 2018 22:28
firejail profile for the Discord Electron "desktop" client
# 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 October 15, 2017 17:45
Bash update global IPv6 with afraid DNS
#!/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 07:53
toggle automute for specific alsa card
#!/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 07:54
x230 tablet scripts for rotating screen and disabling ultranav touchpad/trackpoint
#!/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 October 24, 2016 07:51
install runtimes available in choco
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 January 2, 2018 00:36
lightsout for linux (suspend when no network activity for 1 hour)
#!/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 August 28, 2015 10:25
arch linux service wrapper
#!/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 August 17, 2015 10:08
asound.state for Toshiba Chromebook 2 (CB30-B-104)
state.Intel {
control.1 {
iface CARD
name 'HDMI/DP,pcm=3 Jack'
value false
comment {
access read
type BOOLEAN
count 1
}