Skip to content

Instantly share code, notes, and snippets.

Avatar

Mykhailo Petrenko mykhailo-petrenko

  • Opt/Net B.V.
  • Netherlands, Alkmaar
View GitHub Profile
@mykhailo-petrenko
mykhailo-petrenko / random.cpp
Created Jun 13, 2019
Random метод Лемира
View random.cpp
// https://habr.com/ru/post/455702/
uint32_t bounded_rand(rng_t& rng, uint32_t range) {
uint32_t x = rng();
uint64_t m = uint64_t(x) * uint64_t(range);
uint32_t l = uint32_t(m);
if (l < range) {
uint32_t t = -range;
if (t >= range) {
t -= range;
if (t >= range)
View git-log-to-csv.sh
echo "Hash;Author;Date;Commit" > 'report.csv'
git log --pretty=format:'%h;%an;%ad;%s' --author='Author 1' >> 'report.csv'
git log --pretty=format:'%h;%an;%ad;%s' --author='Author 2' >> 'report.csv'
#
@mykhailo-petrenko
mykhailo-petrenko / gulpfile.js
Created Jul 20, 2018
ngx-translate gulp i18n json merge
View gulpfile.js
/*
npm scripts to add:
"gulp": "gulp",
"gulp-translations-watch": "gulp translations:watch"
*/
const gulp = require('gulp');
const merge = require('gulp-merge-json');
const jsonminify = require('gulp-jsonminify');
/***********************************************************
View sprite-generator.js
// npm install -D glob spritesmith spritesheet-templates
const fs = require('fs');
const glob = require('glob');
const Spritesmith = require('spritesmith');
const templater = require('spritesheet-templates');
const icons = glob.sync('./src/icons/*.png');
const spritePath = `${__dirname}/sprite.png`;
const spriteRelativePath = `/sprite.png`;