Skip to content

Instantly share code, notes, and snippets.

View Ginden's full-sized avatar

Michał Wadas Ginden

  • Future Mind
  • Warsaw, Poland
View GitHub Profile
////////////////////////////////////////////////////////////////////////////////////////////////////////////
// библиоотека patcher_x86.dll
// распространяется свободно(бесплатно)
// авторское право: Баринов Александр (baratorch), e-mail: baratorch@yandex.ru
// форма реализации низкоуровневых хуков (LoHook) отчасти позаимствована у Berserker (из ERA)
////////////////////////////////////////////////////////////////////////////////////////////////////////////
// версия 4.2
////////////////////////////////////////////////////////////////////////////////////////////////////////////
window._eventLog = (function(longTime, important) {
var eventLog = [];
eventLog.getLongEvents = function(time) {
time = time === undefined ? longTime : time;
return this.filter(function(el) {
return el.time > time;
})
}
// Should we filter mousemove?
@Ginden
Ginden / gkeys.txt
Last active April 30, 2020 21:22
List of G-keys combinations bytecodes (Logitech G910)
G1 + G2 - b'\x11\xff\x08\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
G1 + G3 - b'\x11\xff\x08\x00\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
G1 + G4 - b'\x11\xff\x08\x00\t\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
G1 + G5 - b'\x11\xff\x08\x00\x11\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
G1 + G6 - b'\x11\xff\x08\x00!\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
G1 + G7 - b'\x11\xff\x08\x00A\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
G1 + G8 - b'\x11\xff\x08\x00\x81\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
G1 + G9 - b'\x11\xff\x08\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
G2 + G3 - b'\x11\xff\x08\x00\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
/sbin/ldconfig.real: Can't stat /usr/local/cuda-8.0/targets/x86_64-linux/lib: No such file or directory
/sbin/ldconfig.real: Can't stat /usr/local/cuda-9.0/targets/x86_64-linux/lib: No such file or directory
/sbin/ldconfig.real: Can't stat /usr/local/cuda-9.2/targets/x86_64-linux/lib: No such file or directory
/sbin/ldconfig.real: Path `/usr/lib/nvidia-410' given more than once
/sbin/ldconfig.real: Path `/usr/lib32/nvidia-410' given more than once
/sbin/ldconfig.real: Path `/lib/x86_64-linux-gnu' given more than once
/sbin/ldconfig.real: Path `/usr/lib/x86_64-linux-gnu' given more than once
/sbin/ldconfig.real: /lib/x86_64-linux-gnu/ld-2.23.so is the dynamic linker, ignoring
/sbin/ldconfig.real: /lib32/ld-2.23.so is the dynamic linker, ignoring
import {Foo} from './foo.ts';
export class Bar extends Foo {}
const _ = require('lodash');
function bm() {
var u = 0, v = 0;
while(u === 0) u = Math.random(); //Converting [0,1) to (0,1)
while(v === 0) v = Math.random();
return Math.sqrt( -2.0 * Math.log( u ) ) * Math.cos( 2.0 * Math.PI * v );
}
console.log(
@Ginden
Ginden / FooArray.js
Last active February 11, 2019 22:26
class FooArray extends Array {
constructor(...args) {
super(...args);
return new Proxy(this, {
defineProperty(target, property, descriptor) {
console.log({target, property, descriptor});
return Reflect.defineProperty(target, property, descriptor);
}
})
}
# ./configure --enable-cuda --enable-cuvid --enable-nvenc --enable-nonfree --enable-libnpp --extra-cflags=-I/usr/local/cuda/include --extra-ldflags=-L/usr/local/cuda/lib64
ALL_COMPONENTS='
aac_adtstoasc_bsf
av1_metadata_bsf
chomp_bsf
dump_extradata_bsf
dca_core_bsf
eac3_core_bsf
extract_extradata_bsf
liczbaOsob = [0.7, 2.6, 1].map(e => e/100).reduce((a,b) => a*b)*38*1000*1000;
liczbaProb = 100;
Array.from({length: liczbaProb}, () => Object.entries(Array.from({length: liczbaOsob})
.map(e => Math.random()*70*365)
.map(Math.floor)
.reduce((obj, k) => (obj[k] = (obj[k]|0)+1, obj), {}))
.filter(([,v]) => v > 1).length)
.reduce((a,b)=>a+b)/liczbaProb
Array.prototype.replace = function replace(map) {
const newArray = [];
for(const [index, value] of this.entries()) {
if(map.has(value)) {
newArray[index] = map.get(value);
} else {
newArray[index] = value;
}
}
return newArray;