Skip to content

Instantly share code, notes, and snippets.

use std::fs::File;
use std::io::Read;
use regex::Regex;
pub fn status(port: Option<u16>) -> () {
tool_versions();
}
pub fn start(port: Option<u16>) -> () {
println!("{ }", tool_versions());
SELECT nspname || '.' || relname AS "relation",
pg_size_pretty(pg_total_relation_size(C.oid)) AS "total_size"
FROM pg_class C
LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace)
WHERE nspname NOT IN ('pg_catalog', 'information_schema')
AND C.relkind <> 'i'
AND nspname !~ '^pg_toast'
ORDER BY pg_total_relation_size(C.oid) DESC
LIMIT 5;
@denisoster
denisoster / divos-hack.c
Last active June 11, 2022 00:52
Arch hack Divinity Original Sin Enhanced Edition, GOG version
/*
* LD_PRELOAD shim which applies two patches necesary to get the game
* Divinity: Original Sin Enhanded Edition for Linux to work with Mesa (12+)
*
* Build with: gcc -s -O2 -shared -fPIC -o divos-hack.{so,c} -ldl
*/
/* for RTLD_NEXT */
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
/Users/denisoster/.cargo/bin/cargo run --color=always --package iwt --bin iwt
Compiling iwt v0.1.0 (/Users/denisoster/Projects/rust/iwt)
error[E0382]: borrow of moved value: `line`
--> src/main.rs:18:41
|
14 | let line = line.unwrap(); // Ignore errors.
| ---- move occurs because `line` has type `std::string::String`, which does not implement the `Copy` trait
...
18 | fs::copy(line, format!("to/{}", line));
| ---- value moved here ^^^^ value borrowed here after move
>> attributes_keys
{:country_ids=>:country_id, :group_type_ids=>:group_type_id, :region_ids=>:region_id, :city_ids=>:city_id}
(byebug) >> keys
[:country_ids, :city_ids]
(byebug) >> attributes_keys.slice(*keys)
{:country_ids=>:country_id, :city_ids=>:city_id}
(byebug) >> attributes_keys.slice(*keys).values
[:country_id, :city_id]
(byebug) >> attributes_keys.slice(*keys).values.zip(p)
[[:country_id, 1001], [:city_id, 1213]]
λ ~/ lutris
2020-05-03 20:50:59,657: Running Lutris 0.5.6
2020-05-03 20:50:59,657: Using Intel Open Source Technology Center
2020-05-03 20:50:59,657: Running Mesa driver 20.0.6 on Mesa DRI Intel(R) HD Graphics 4400 (HSW GT2) (0xa16)
2020-05-03 20:50:59,658: GPU: 8086:0A16 17AA:220C using i915 drivers
INTEL-MESA: warning: Haswell Vulkan support is incomplete
2020-05-03 20:50:59,670: Vulkan is supported
2020-05-03 20:50:59,671: Updating DXVK versions
2020-05-03 20:50:59,861: Connected to lutris.net as oster
lutris-wrapper: Alan Wake
@denisoster
denisoster / example.js
Created May 5, 2020 08:07
'arrow function syntax (=>)' is only available in ES6 (use esnext option).
function disabledCheckBoxes(elements) {
document.querySelectorAll(elements).forEach(element => {
element.setAttribute("disabled", "disabled");
});
}
function enabledCheckBoxes(elements) {
document.querySelectorAll(elements).forEach(element => {
element.removeAttribute("disabled");
#!/bin/bash
Xephyr -ac -br -noreset -screen 1366x768 :1 &
sleep .1
DISPLAY=:1 awesome -c "/home/denis/.config/awesome/rc.lua"
pkill -KILL Xephyr
POSTGRES_EXTRA_CONFIGURE_OPTIONS="--with-gssapi --with-libxml --with-openssl --with-perl --with-python --with-tcl --with-pam --with-system-tzdata=/usr/share/zoneinfo --with-uuid=e2fs --with-icu --with-systemd --with-ldap --with-llvm --enable-nls --enable-thread-safety --disable-rpath" asdf install postgres