Skip to content

Instantly share code, notes, and snippets.

View th3hunt's full-sized avatar
🎯
Focusing

Stratos Pavlakis th3hunt

🎯
Focusing
  • Blueground
  • Athens
View GitHub Profile
@th3hunt
th3hunt / postgres_queries_and_commands.sql
Created October 11, 2023 13:08 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@th3hunt
th3hunt / ProGit.md
Last active August 11, 2023 08:50
Pro Git - A list of Git aliases & recipes to Git like a 😎

Pro Git

A list of Git aliases & recipes to Git like a 😎.

Aliases

# ~/.git/config

[alias]
  # List all aliases :)
  la = "!git config -l | grep alias | cut -c 7-"
@th3hunt
th3hunt / jupyterlab_shortcuts.md
Created June 18, 2023 08:06 — forked from discdiver/jupyterlab_shortcuts.md
Common Jupyter Lab Keyboard Shortcuts

If you are on a Mac, substitute command for control. Don't type the + (it means press both keys at once).

Shortcuts when in either command mode (outside the cells) or edit mode (inside a cell):

  • Shift + Enter run selected cell or cells - if no cells below, insert a code cell below

  • Ctrl + B toggle hide/show left sidebar

  • Ctrl + S save and checkpoint

  • Ctrl + Shift + S save as

@th3hunt
th3hunt / esm-cjs-modules.md
Created April 5, 2022 12:24 — forked from aelbore/esm-cjs-modules.md
Publish your npm package as ES Module, and backward compatibility CommonJS

Create your library

  • Initialize project npm init -y
  • Create esm module ./src/esm/my-lib.js
    function addNumber(value, value2) {
      return value + value2;
    }
    
    export { addNumber };
@th3hunt
th3hunt / http_streaming.md
Created February 27, 2022 10:46 — forked from CMCDragonkai/http_streaming.md
HTTP Streaming (or Chunked vs Store & Forward)

HTTP Streaming (or Chunked vs Store & Forward)

The standard way of understanding the HTTP protocol is via the request reply pattern. Each HTTP transaction consists of a finitely bounded HTTP request and a finitely bounded HTTP response.

However it's also possible for both parts of an HTTP 1.1 transaction to stream their possibly infinitely bounded data. The advantages is that the sender can send data that is beyond the sender's memory limit, and the receiver can act on

@th3hunt
th3hunt / loadScript.js
Last active May 18, 2021 12:53
Script & CSS load utils
export const status = {
TIMEOUT: 'timeout',
SUCCESS: 'success',
SKIPPED: 'skipped'
};
/**
* Load a JS script programmatically.
*
* The <script> element get inserted as the last child of <body> by default but can be customized
@th3hunt
th3hunt / nestedHistory.js
Created November 18, 2020 15:57
Nested History
/**
* NestedHistory
* -------------
*
* TODO: doc
*
*/
import _ from 'underscore';
@th3hunt
th3hunt / .gitconfig
Last active November 12, 2020 19:32
.gitconfig
[alias]
co = checkout
go = checkout -b
st = status
pr = pull --rebase
br = branch
filediff = diff --name-only
last = log -1 HEAD
fixup = commit --fixup
rebase-auto = git rebase --interactive --autosquash
@th3hunt
th3hunt / ajaxSetup.js
Last active October 1, 2020 10:55
Global ajax handling skeleton
(function (App) {
/**
* Do before each Ajax request
* ---------------------------
*
* 1. Disable ajax related DOM controls to prevent double submissions
* 2. Extend each XHR object with a couple of methods that let ajax calls skip global handlers on-demand.
*
*/
@th3hunt
th3hunt / pan.js
Last active August 19, 2020 08:14
Pan gesture helpers
/**
* Pan
* ---
*
* A collection one-finger Pan gesture recognizers.
*
* A pan is an omnidirectional one- or two-finger gesture that expands the field of view.
* Drag is typically used with pan.
*
*/