Skip to content

Instantly share code, notes, and snippets.

View sitano's full-sized avatar

Ivan Prisyazhnyy sitano

View GitHub Profile
@digulla
digulla / SDL-1.2.14-x11modes.patch
Created December 4, 2011 11:43
Patch to force a certain window/screen size in SDL games
--- SDL-1.2.14/src/video/x11/SDL_x11modes.c 2009-10-13 01:07:15.000000000 +0200
+++ SDL-1.2.14/src/video/x11/SDL_x11modes.c 2011-12-04 12:34:55.000000000 +0100
@@ -33,7 +33,7 @@
#include "SDL_x11modes_c.h"
#include "SDL_x11image_c.h"
-/*#define X11MODES_DEBUG*/
+#define X11MODES_DEBUG
#define MAX(a, b) (a > b ? a : b)
@mitchellh
mitchellh / gist:6531113
Last active December 23, 2015 21:08
`go get` replacement that works around Go issue #5375 (go get doesn't work with private Bitbucket repositories)
#!/bin/bash
#
# Due to a bug in Go, you can't `go get` a private Bitbucket repository
# (issue #5375, linked below). This means you can't `go get ./...` ANY project
# that might depend on a private Bitbucket repository.
#
# This script works around it by detecting Bitbucket imports and using
# `git` directly to clone into it. This will not work if you use private
# Mercurial repositories on Bitbucket.
#

 "картинка для привлечения внимания"

О специальной олимпиаде Haskell vs Python (pypy) vs всё остальное

Первоначально задача возникла в https://t.me/haskellru и формулировалась примерно так: почему следующий код на Haskell

unsigned integers

-O3

|               ns/op |                op/s |   MdAPE | benchmark
|--------------------:|--------------------:|--------:|:----------------------------------------------
|                3.03 |      329,748,861.72 |    3.2% | `(a + b) / 2`
|                3.01 |      332,744,047.95 |    4.1% | `a + ((b - a) / 2)`
|                3.01 |      331,690,526.09 |    2.3% | `A/2 + B/2 + (A & B & 1)`
|                3.13 |      318,986,706.11 |    2.3% | `std::midpoint()`
@jassinm
jassinm / .ycm_extra_conf.py
Last active April 7, 2020 04:05
c++11 youcompleteme
import os
import ycm_core
from clang_helpers import PrepareClangFlags
# Set this to the absolute path to the folder (NOT the file!) containing the
# compile_commands.json file to use that instead of 'flags'. See here for
# more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html
# Most projects will NOT need to set this to anything; you can just change the
# 'flags' list of compilation flags. Notice that YCM itself uses that approach.
compilation_database_folder = ''
@philips
philips / user-data
Last active September 16, 2020 14:19
Running consul on top of CoreOS utilizing etcd for automatic bootstrapping.
#!/bin/bash
source /etc/environment
name=$(cat /etc/machine-id)
if [ ! -f /opt/consul ]; then
mkdir /opt
mkdir /var/lib/consul
curl http://storage.googleapis.com/ifup-org-tilde/consul-0.2.0-linux-x86-64.lzma | lzcat > /opt/consul
chmod +x /opt/consul
@garethrees
garethrees / gist:5591027
Last active October 14, 2020 19:44
Ansible set timezone on Ubuntu host
- name: Group by Distribution
hosts: all
tasks:
- group_by: key=${ansible_distribution}
- name: Set Time Zone
hosts: Ubuntu
gather_facts: False
tasks:
- name: Set timezone variables
@limitedeternity
limitedeternity / source.js
Last active September 2, 2021 11:17
Decrypt m3u8 files from play.boomstream.com/player.html
// FileSaver.min.js
(function(a,b){if("function"==typeof define&&define.amd)define([],b);else if("undefined"!=typeof exports)b();else{b(),a.FileSaver={exports:{}}.exports}})(this,function(){"use strict";function b(a,b){return"undefined"==typeof b?b={autoBom:!1}:"object"!=typeof b&&(console.warn("Depricated: Expected third argument to be a object"),b={autoBom:!b}),b.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(a.type)?new Blob(["\uFEFF",a],{type:a.type}):a}function c(b,c,d){var e=new XMLHttpRequest;e.open("GET",b),e.responseType="blob",e.onload=function(){a(e.response,c,d)},e.onerror=function(){console.error("could not download file")},e.send()}function d(a){var b=new XMLHttpRequest;return b.open("HEAD",a,!1),b.send(),200<=b.status&&299>=b.status}function e(a){try{a.dispatchEvent(new MouseEvent("click"))}catch(c){var b=document.createEvent("MouseEvents");b.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),a.dispatchEvent(b)}}var f="object"==typeof
#!/usr/bin/python
# to try this you'll need to edit in the name of your ruby binary and install bcc-tools
# bcc installation instructions are at https://github.com/iovisor/bcc/blob/master/INSTALL.md
from __future__ import print_function
from bcc import BPF
from time import sleep
import os
# load BPF program