Skip to content

Instantly share code, notes, and snippets.

View sagebind's full-sized avatar
💭
Limited availability for Open Source

Stephen M. Coakley sagebind

💭
Limited availability for Open Source
View GitHub Profile
@sagebind
sagebind / Makefile
Last active July 24, 2020 15:32
Example C program for curl issue #5717
.PHONY: run-old
run-old: out/old
$<
.PHONY: run-new
run-new: out/new
$<
.PHONY: clean
clean:
@sagebind
sagebind / 10-nvidia-offload.conf
Created July 3, 2020 22:31
NVIDIA Prime offloading config for Ubuntu
Section "Files"
ModulePath "/usr/lib/xorg/modules"
ModulePath "/usr/lib/x86_64-linux-gnu/nvidia/xorg"
EndSection
Section "ServerLayout"
Identifier "layout"
Screen 0 "iGPU"
Option "AllowNvidiaGpuScreens"
EndSection
@sagebind
sagebind / steam-976730.log
Created April 5, 2020 07:19
steam-976730.log
This file has been truncated, but you can view the full file.
======================
Proton: 1584918606 proton-5.0-5b
SteamGameId: 976730
Command: ['/data/SteamLibrary/steamapps/common/Halo The Master Chief Collection/MCC/Binaries/Win64/MCC-Win64-Shipping.exe']
Options: {'nofsync', 'forcelgadd', 'noesync'}
======================
ERROR: ld.so: object '/home/stephen/.local/share/Steam/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.
ERROR: ld.so: object '/home/stephen/.local/share/Steam/ubuntu12_64/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored.
ERROR: ld.so: object '/home/stephen/.local/share/Steam/ubuntu12_64/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored.
ERROR: ld.so: object '/home/stephen/.local/share/Steam/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.
#![feature(specialization)]
const fn type_eq<T: ?Sized, U: ?Sized>() -> bool {
trait Bool {
const VALUE: bool;
}
struct True;
impl Bool for True {
@sagebind
sagebind / transmogrify.rs
Last active December 3, 2019 21:14
Downcast like Any, but without trait objects
use std::{any::TypeId, mem};
/// A trait for zero-cost type casting in generic contexts to allow limited
/// forms of specialization at runtime.
///
/// Similar to [`std::any::Any`], but does not require trait objects nor heap
/// allocation. Because of this, in most situations transmogrification will be
/// completely optimized away by the compiler, giving you effectively the same
/// performance as actual specialization.
pub trait Transmogrify: 'static {
@sagebind
sagebind / GPD-MicroPC-drm-panel-quirks.patch
Created June 23, 2019 05:14
GPD MicroPC production panel orientation patch
diff --git a/drivers/gpu/drm/drm_panel_orientation_quirks.c b/drivers/gpu/drm/drm_panel_orientation_quirks.c
index d8a0bcd02..11468bcf3 100644
--- a/drivers/gpu/drm/drm_panel_orientation_quirks.c
+++ b/drivers/gpu/drm/drm_panel_orientation_quirks.c
@@ -42,7 +42,7 @@ static const struct drm_dmi_panel_orientation_data asus_t100ha = {
.orientation = DRM_MODE_PANEL_ORIENTATION_LEFT_UP,
};
-static const struct drm_dmi_panel_orientation_data gpd_micropc = {
+static const struct drm_dmi_panel_orientation_data gpd_micropc_preproduction = {
@sagebind
sagebind / ads.user.css
Last active March 15, 2019 01:02
Usercss
/* ==UserStyle==
@name Hide ads on specific sites
@namespace github.com/sagebind
@version 0.1.0
==/UserStyle== */
@-moz-document domain("www.deviantart.com") {
.da-custom-ad-box, .da-ad-high-impact {
display: none !important;
}
@sagebind
sagebind / watch.js
Created May 25, 2017 15:19
Function that watches the property of any object for changes.
/**
* Standalone function used to continuously watch the property of an object for changes.
*
* The function is as optimized as possible to reduce needless timeout and interval callbacks, but this should still be
* used sparingly and only when events are not possible.
*
* Usage:
* var item = watch(someObject, "propertyName", function(oldValue, newValue, cancel) {
* // Handle the change here.
* // Optionally cancel watching.
pub trait CodeValue: Sized {
fn value(&self) -> &str;
fn from_value(value: &str) -> Option<Self>;
}
macro_rules! code_value_enum {
(
$NAME:ident {
@sagebind
sagebind / halo.sh
Created January 8, 2017 20:59
Halo Wine + Optimus Launcher
#!/usr/bin/env sh
export WINEPREFIX="$HOME/.wine"
cd "$HOME/.wine/drive_c/Program Files (x86)/Microsoft Games/Halo"
optirun wine "$PWD/halo.exe" -vidmode 1920,1080,60