This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# https://www.reddit.com/r/homelab/comments/b5xpua/the_ultimate_beginners_guide_to_gpu_passthrough/ | |
# intel based script | |
apt-get update | |
apt-get upgrade -y | |
echo "current value of GRUB_CMDLINE_LINUX_DEFAULT" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ irb -r ./select_server | |
>> client.puts "hi" | |
=> nil | |
>> client.puts "bye" | |
=> nil | |
>> client.close | |
=> nil | |
>> exit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1. Clear retry set | |
Sidekiq::RetrySet.new.clear | |
# 2. Clear scheduled jobs | |
Sidekiq::ScheduledSet.new.clear | |
# 3. Clear 'Processed' and 'Failed' jobs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ for i in {1..12}; do date -v1d -v-1d -v-${i}m +%Y-%m-%d; done | |
2018-11-30 | |
2018-10-31 | |
2018-09-30 | |
2018-08-31 | |
2018-07-31 | |
2018-06-30 | |
2018-05-31 | |
2018-04-30 | |
2018-03-31 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sleep 10 && echo -en "\007" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# gem install benchmark-ips | |
require "benchmark/ips" | |
path = "lib/rubycritic/cli/options.rb" | |
Benchmark.ips do |x| | |
x.report("read + each_line") { File.read(path).each_line.count } | |
x.report("open + each_line") { File.open(path, "r").each_line.count } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT l.what, l.nr AS "bytes/ct" | |
, CASE WHEN is_size THEN pg_size_pretty(nr) END AS bytes_pretty | |
, CASE WHEN is_size THEN nr / x.ct END AS bytes_per_row | |
FROM ( | |
SELECT min(tableoid) AS tbl -- same as 'public.tbl'::regclass::oid | |
, count(*) AS ct | |
, sum(length(t::text)) AS txt_len -- length in characters | |
FROM public.write_a_table_name_instead t -- provide table name *once* | |
) x | |
, LATERAL ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE accounts( | |
id serial PRIMARY KEY, | |
name VARCHAR(256) NOT NULL | |
); | |
CREATE TABLE entries( | |
id serial PRIMARY KEY, | |
description VARCHAR(1024) NOT NULL, | |
amount NUMERIC(20, 2) NOT NULL CHECK (amount > 0.0), | |
-- Every entry is a credit to one account... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"os" | |
"os/signal" | |
"syscall" | |
"time" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Move erts IO Polling to dedicated threads | |
# https://github.com/erlang/otp/pull/1552 |
NewerOlder