Skip to content

Instantly share code, notes, and snippets.

Avatar

Gleb Mazovetskiy glebm

View GitHub Profile
@glebm
glebm / gamepad.cfg
Last active Jan 3, 2021
gamepad configuration for xash3d-fwgs
View gamepad.cfg
// Default gamepad bindings
// == Bindings ==
// https://raw.githubusercontent.com/krishenriksen/Half-Life-rg351p/main/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
@glebm
glebm / primes.rs
Last active Aug 22, 2020
Rust: Erathosthenes prime sieve
View primes.rs
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 Aug 3, 2012 — forked from migrs/bluepill
bluepill init script
View bluepill
#!/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.
View mke2fs.conf.diff
--- /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 Feb 15, 2020
FindSDL_gfx.cmake
View 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 Jun 22, 2014
Missing and unused translations report (i18n-tasks v0.5.0+)
View i18n_status.html.slim
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 / README.md
Last active Dec 29, 2019
Rails Link Preload Headers
View README.md

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

View topsort.cpp
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) {
View libsass-2908.patch
diff --git a/src/extender.cpp b/src/extender.cpp
index 6d96b8d0..8456a6a1 100644
--- a/src/extender.cpp
+++ b/src/extender.cpp
@@ -287,11 +287,11 @@ namespace Sass {
// Note: this function could need some logic cleanup
// ##########################################################################
void Extender::addExtension(
- SelectorListObj& extender,
- SimpleSelectorObj& target,
View script.rb
# A module which is an instance of the Script class encapsulates in its scope
# the top-level methods, top-level constants, and instance variables defined in
# a ruby script file (and its subfiles) loaded by a ruby program. This allows
# use of script files to define objects that can be loaded into a program in
# much the same way that objects can be loaded from YAML or Marshal files.
#
# See intro.txt[link:files/intro_txt.html] for an overview.
class Script < Module
# The file with which the Script was instantiated.
You can’t perform that action at this time.