Skip to content

Instantly share code, notes, and snippets.

View raspi's full-sized avatar

raspi

  • finland
  • 09:31 (UTC +03:00)
View GitHub Profile
@raspi
raspi / network-ping-gateway.service
Created October 20, 2017 18:42
Systemd service for pinging default gateway
# Save in /etc/systemd/system/network-ping-gateway.service
[Unit]
Description=Ping default network gateway service
After=network-online.target
[Service]
# Wait time if process hangs
TimeoutStopSec=1m
# Command to run
@raspi
raspi / md5move.py
Last active October 1, 2018 21:19
Move files based on file list in a md5 checksum file
#!/bin/env/python
# -*- encoding: utf8 -*-
# Move files based on file list in a md5 checksum file
# (c) Pekka Järvinen 2017-
import logging
log = logging.getLogger(__name__)
import os
@raspi
raspi / Deus Ex Mankind Divided - Remove intro videos.ps1
Created March 7, 2018 22:42
Remove annoying intro videos from Deus Ex Mankind Divided
# Remove annoying intro videos from Deus Ex Mankind Divided
# Finds DXMD path from registry
# Steam application id (337000 = Deus Ex Mankind Divided)
$steamAppId = 337000
# Empty BINK video
$emptyVideo = @(
0x4B, 0x4E, 0x49, 0x42, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@raspi
raspi / nvidia-driver-remove-crap.ps1
Last active June 2, 2018 02:07
Remove unnecessary trash from nvidia GPU driver installer
# Remove unnecessary trash from nvidia GPU driver installer
# Modifies the setup.cfg XML file and removes garbage directories as well
# First unpack the installer .exe with 7zip and then run:
# this_script.ps1 <unpack directory>
# (c) Pekka Järvinen 2018-
param (
[Parameter(Mandatory=$true)][ValidateScript({Test-Path $_})] [string]$unpackDir
)
@raspi
raspi / main.py
Created June 12, 2018 20:10
Eduskunnan spostit
import logging
import os
import sys
# 3rd party
from bs4 import BeautifulSoup
import requests
if __name__ == "__main__":
@raspi
raspi / json_middleware.go
Created June 29, 2018 17:38
Check JSON middleware
package main
import (
"time"
"net/http"
"log"
"io/ioutil"
"encoding/json"
router "github.com/go-chi/chi"
routermw "github.com/go-chi/chi/middleware"
@raspi
raspi / dl_geforce_drivers.ps1
Created July 14, 2018 16:03
Download newest nVidia GeForce drivers
# Download latest geforce drivers
# TODO: find a way to get series (ex: GeForce 10 Series) id somehow
Add-Type -AssemblyName System.Web
Import-Module BitsTransfer
$systemLocaleCode = Get-UICulture | select -ExpandProperty LCID
# Get machine's GPUs
$gpus = @{}
@raspi
raspi / freebsd_list_kernel_modules.sh
Last active September 27, 2018 19:13
List kernel module descriptions in BSD
# 2> /dev/null skips manual pages which doesn't exist
# find /boot/kernel -type f -iname "*acpi*.ko" -exec sh -c 'whatis `basename "{}" ".ko"` 2> /dev/null' \;
acpi_toshiba(4) - Toshiba HCI interface
acpi_panasonic(4) - ACPI hotkey driver for Panasonic laptops
acpi_fujitsu(4) - Fujitsu Laptop Extras
acpi_wmi(4) - ACPI to WMI mapping driver
acpi_hp(4) - ACPI extras driver for HP laptops
acpi_dock(4) - Laptop Docking Station device driver
acpi_sony(4) - ACPI notebook controller driver for Sony laptops

Settable via /etc/sysctl.conf:

integer kern.maxvnodes

Target for maximum number of vnodes

integer kern.maxfiles

Maximum number of files

integer kern.securelevel

Current secure level

@raspi
raspi / freebsd_rc.md
Last active September 27, 2018 19:05

accept_sourceroute (default: NO)

accept source routed packets to us

accounting_enable (default: NO)

Turn on process accounting (or NO).

allscreens_flags (default: empty)

Set this vidcontrol mode for all virtual screens

allscreens_kbdflags (default: empty)