Skip to content

Instantly share code, notes, and snippets.

View panta82's full-sized avatar

Ivan Pantic panta82

View GitHub Profile
WITH pushes AS (
SELECT
"git_pushes".*,
(
CASE WHEN COUNT("git_commits") = 0
THEN '[]'::jsonb
ELSE jsonb_agg("git_commits" ORDER BY "git_commits"."id" DESC)
END
) AS commits
FROM "git_pushes"
@panta82
panta82 / README.md
Last active March 27, 2024 20:00
Foobar2000 + wine setup
@panta82
panta82 / get-shortcut-target.cmd
Last active May 12, 2019 20:14
Command line launcher for JetBrains tools on Windows
@echo off
setlocal
rem // ensure user supplied a filename with a .lnk extension
if /i "%~x1" neq ".lnk" (
echo usage: %~nx0 shortcut.lnk
goto :EOF
)
rem // set filename to the fully qualified path + filename
@panta82
panta82 / gist:3abeae61b14d197223855a5ba3c7ffdf
Created October 30, 2018 07:59
Show branches sorted by the latest commit
brs = "!f(){ git fetch --all --prune ; git for-each-ref --sort=-committerdate refs/heads/ --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(color:red)%(objectname:short)%(color:reset) - %(contents:subject) - %(authorname) (%(color:green)%(committerdate:relative)%(color:reset))' ; };f"
@panta82
panta82 / problem.md
Last active June 25, 2018 12:51
Call order verification problem

"Consume" is a "black-box" function in this format:

function consume(data, callback) {
  //...
}

Caller puts in some data and is called back with the callback. Callbacks are supposed to be in the same sequence as input calls.

...............................................,,;''++##@@######@#####';'':;,:,,,,,,,,,:,::::::::::::::::::::::::
.............................................,,:'++######@####@#@@##@##++'+:::::,:,,,,:::::::::::::::::::::::::::
..........................................,,,,;'+#######@@@@#@@@@@@##@###+++'';,,;::,::::::::::::::::::::::::::::
..........................................,:,;++#######@@@@@@@@@@@@##@@###+#++'::;;::::::::::::::::::::::::::::::
........................................,.,;:++####@@@@@@@@@@@@@@#@##@@@#####++;;'+::::::::::::::::::;;:::::::::;
.......................................,,,:;++##@@@@@@@@@@@@@@@@@@##@@@@@######+'+#;:::::::::::::;;;;;;;;;;:;;;:;
........................................,';'###@@@@@@@@@@@@@@@@@@@##@@@@##@########;:::::::;;;;;;;;;;;;;;;;;;;;;;
....................................,,,,:+++##@@@@@@@@@@@@@@@@@@@@###@@@##@@@#@@###;;:::::;;;;;;;;;;;;;;;;;;;;;;;
.................................,.,:::'++####@@@@@@@@@@@@#@@@@@#@@@@@@@@@####@@###';:;:;;;;;;;;;;;;;;;;;;;;
@panta82
panta82 / tasks.md
Created December 13, 2017 11:42
Beginner programming tasks

Beginner programming tasks

1. VR

Write a program that outputs numbers from 1 to 100. Except, for every 3rd number, it should write "V", for every 5th number it should write "R" and for every 15th number it should write "VR".

Example output:

1
2
@panta82
panta82 / react_router.js
Last active November 30, 2017 13:29
React Router annotations
**/
createLocation(location) {}
/**
* This seems to be the same as createHref, only without prepending #/ and base path
* @param {RouterLocation|string} location
* @returns string
**/
createPath(location) {}
@panta82
panta82 / slow_copy.js
Created March 8, 2016 10:00
Copy file sloooooowly, so that we can test network related stuff
#!/usr/bin/env node
var fs = require('fs');
var util = require('util');
var DEFAULT_BPS = 10 * 1000; // 10 kb / sec
var source = process.argv[2];
if (!source) {
return usage(1);
@panta82
panta82 / lsof.js
Last active March 8, 2016 10:51
Get lsof information about a file (list of processes that are accessing that file)
var exec = require('child_process').exec,
util = require('util');
var target = process.argv[2];
if (!target) {
return usage(1);
}
var FIELDS = ['pid', 'command', 'uid', 'lock'];
var FIELD_OPTIONS = {