Skip to content

Instantly share code, notes, and snippets.

View qzb's full-sized avatar
🌟
(ノ◕ヮ◕)ノ*:・゚✧

Józef Sokołowski qzb

🌟
(ノ◕ヮ◕)ノ*:・゚✧
  • Satim Inc.
  • Cracow
View GitHub Profile
@qzb
qzb / era-manager.sh
Created April 21, 2017 22:33
ESET Remote Administrator management script for Mac OS X.
#!/usr/bin/env bash
function is_running () {
ps auwwx | grep -v grep | grep -iq 'eset remote administrator'
return $?
}
function usage () {
echo "CLI tool to manage Eset Remote Administator on macOS."
echo "Usage: $(basename $0) COMMAND"
@qzb
qzb / create-apng.js
Created August 30, 2016 20:55
Merges multiple PNG images into single APNG animation
const fs = require('fs')
const crc32 = require('crc').crc32
function findChunk(buffer, type) {
let offset = 8
while (offset < buffer.length) {
let chunkLength = buffer.readUInt32BE(offset)
let chunkType = buffer.slice(offset + 4, offset + 8).toString('ascii')
@qzb
qzb / game_of_life.py
Last active August 30, 2016 20:56
Simple simulation of Conway's Game of Life in single line of code.
(lambda libs: (lambda args: (lambda data: (lambda whatever: map(lambda index: libs['time'].sleep(1./args['fps']) or libs['sys'].stdout.write(index!=0 and '\033[H' or '') or libs['sys'].stdout.write('\n'.join([''.join([cell and unichr(0x2588).encode('utf8') or ' ' for cell in row]) for row in data[index]])), range(args['steps'])))([ data.__setitem__(i, [[(lambda _u, _r, _d, _l: (lambda val: (val in args['life'] and 1 or 0) if data[i-1][r][c] else (val in args['born'] and 1 or 0))(sum(map(lambda t: data[i-1][t[0]][t[1]], [(_u,_l),(_u,c),(_u,_r),(r,_l),(r,_r),(_d,_l),(_d,c),(_d,_r)]))))(r<args['height']-1 and r+1 or 0, c<args['width']-1 and c+1 or 0, r==0 and args['height']-1 or r-1, c==0 and args['width']-1 or c-1) for c in range(args['width'])] for r in range(args['height'])]) for i in range(1,args['steps'])]))([[[s!=0 and 1 or c>10 and c<args['width']-12 and r==args['height']/2 and 1 or 0 for c in range(args['width'])] for r in range(args['height'])] for s in range(args['steps'])]))((lambda argv: {'steps': in