Skip to content

Instantly share code, notes, and snippets.

View glebm's full-sized avatar

Gleb Mazovetskiy glebm

View GitHub Profile
@glebm
glebm / gamepad.cfg
Last active December 5, 2023 10:55
gamepad configuration for xash3d-fwgs
// Default gamepad bindings
// == Bindings ==
// https://raw.githubusercontent.com/krishenriksen/Half-Life-rg351p/da77c22b60c29589240b86608495574672105206/Half-Life/controls.png
//
// Left stick: Move/Strafe (Walk instead of run when pressed)
// Right stick: Look (Crouch when pressed)
// D-Pad Up: Spray
// D-Pad Down: Quick swap weapon
// D-Pad Left: Prev Weapon
during GIMPLE pass: dse
/home/gleb/devilutionX/Source/options.cpp: In function ‘AddAction.constprop’:
/home/gleb/devilutionX/Source/options.cpp:1700:6: internal compiler error: in binds_to_current_def_p, at symtab.cc:2494
1700 | void PadmapperOptions::AddAction(std::string_view key, const char *name, const char *description, ControllerButtonCombo defaultInput, std::function<void()> actionPressed, std::function<void()> actionReleased, std::function<bool()> enable, unsigned index)
| ^
during GIMPLE pass: store-merging
/home/gleb/devilutionX/build-windows9x-min/_deps/libfmt-src/include/fmt/format.h: In member function ‘__ct ’:
/home/gleb/devilutionX/build-windows9x-min/_deps/libfmt-src/include/fmt/format.h:2067:12: internal compiler error: in binds_to_current_def_p, at symtab.cc:2494
2067 | explicit digit_grouping(locale_ref loc, bool localized = true) {
| ^
@glebm
glebm / README.md
Last active March 29, 2023 19:56
Rails Link Preload Headers

This lets you set the preload headers for your assets, so that the browser can start fetching them before it begins parsing HTML.

@glebm
glebm / r-studio-chromeos-202101.md
Last active January 29, 2021 21:02
Install RStudio on ChromeOS (29 Jan 2021)

First, install Linux (beta) by following the "Turn on Linux (Beta)" steps described here https://support.google.com/chromebook/answer/9145439?hl=en-GB

Then, copy-paste the following command into the Linux terminal (the black window that opens after you install Linux) and press Enter:

sudo apt update && sudo apt -y upgrade && sudo apt -y install r-base wget libnss3 && \
  wget https://download1.rstudio.org/desktop/bionic/amd64/rstudio-1.4.1103-amd64.deb && \
  sudo apt -y install ./rstudio-1.4.1103-amd64.deb

This will take about ~10 minutes, after which you will have fully functional R-Studio with R v3.5.

@glebm
glebm / primes.rs
Last active August 22, 2020 19:24
Rust: Erathosthenes prime sieve
fn is_prime(n: usize, primes: &Vec<usize>) -> bool {
for &p in primes {
let q = n / p;
if q < p { return true };
let r = n - q * p;
if r == 0 { return false };
}
panic!("too few primes")
}
@glebm
glebm / bluepill
Created August 3, 2012 23:43 — forked from migrs/bluepill
bluepill init script
#!/bin/sh
### BEGIN INIT INFO
# Provides: bluepill
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: bluepill daemon, providing process monitoring
# Description: bluepill is a monitoring tool. More info at http://github.com/arya/bluepill.
--- /etc/mke2fs.conf 2019-09-30 18:57:59.000000000 +0100
+++ mke2fs.conf 2020-03-28 16:12:38.972403738 +0000
@@ -1,5 +1,5 @@
[defaults]
- base_features = sparse_super,large_file,filetype,resize_inode,dir_index,ext_attr
+ base_features = sparse_super,large_file,filetype,resize_inode,dir_index
default_mntopts = acl,user_xattr
enable_periodic_fsck = 0
blocksize = 4096
@@ -11,7 +11,7 @@
@glebm
glebm / FindSDL_gfx.cmake
Created February 15, 2020 19:02
FindSDL_gfx.cmake
# Tries to find SDL_gfx (for SDL1)
# Once done, this will define:
# > SDL_GFX_FOUND - The system has libnx
# > SDL_GFX_INCLUDE_DIRS - The libnx include directories
# > SDL_GFX_LIBRARIES - The libnx libraries required for using it
find_path(SDL_GFX_INCLUDE_DIR SDL_gfxPrimitives.h
HINTS
$ENV{SDL_GFX_DIR}
$ENV{SDLDIR}
@glebm
glebm / i18n_status.html.slim
Created June 22, 2014 18:06
Missing and unused translations report (i18n-tasks v0.5.0+)
h1 Missing and unused translations
- if @missing.present?
.panel.panel-default
.panel-heading: h3.panel-title #{@missing.leaves.count} missing keys
table.table.table-striped.table-condensed
thead: tr
th.text-right Locale
th Key
th Value
@glebm
glebm / topsort.cpp
Created August 23, 2019 11:28
topsort c++
struct TopSortResult {
bool ok;
// If `ok`, contains the topologically sorted node indices.
// Otherwise, contains indices of a detected cycle.
std::vector<std::size_t> nodes;
};
// Topologically sorts dependencies.
TopSortResult topsort(const std::vector<std::vector<int>> &edges) {