Skip to content

Instantly share code, notes, and snippets.

View tomilov's full-sized avatar

Anatoliy V Tomilov tomilov

  • Yandex
  • Yekaterinburg
View GitHub Profile
@tomilov
tomilov / a_minimal_example.c
Created August 1, 2024 19:12 — forked from yyny/a_minimal_example.c
GDB JIT Interface -- Minimal Example
/* I spent an entire evening getting JIT debug symbols to work in GDB.
* Here is a minimal example to get you started.
* Have fun!
*/
#include <errno.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@tomilov
tomilov / postgres_queries_and_commands.sql
Created October 13, 2022 12:48 — 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%'
@tomilov
tomilov / git-serve.md
Created January 10, 2020 17:19 — forked from datagrok/git-serve.md
How to easily launch a temporary one-off git server from any local repository, to enable a peer-to-peer git workflow.
@tomilov
tomilov / ssh-telegram.sh
Created September 29, 2017 19:51 — forked from matriphe/ssh-telegram.sh
Bash Script to notify via Telegram Bot API when user log in SSH
# save it as /etc/profile.d/ssh-telegram.sh
# use jq to parse JSON from ipinfo.io
# get jq from here http://stedolan.github.io/jq/
USERID="<target_user_id>"
KEY="<bot_private_key>"
TIMEOUT="10"
URL="https://api.telegram.org/bot$KEY/sendMessage"
DATE_EXEC="$(date "+%d %b %Y %H:%M")"
TMPFILE='/tmp/ipinfo-$DATE_EXEC.txt'
if [ -n "$SSH_CLIENT" ]; then
@tomilov
tomilov / stream.js
Created April 23, 2017 18:27 — forked from padenot/stream.js
How to serve media on node.js
var http = require('http');
var path = require('path');
var fs = require('fs');
var AUDIOFILE = "./audio.ogg";
function serveWithRanges(request, response, content) {
var range = request.headers.range;
var total = content.length;
var parts = range.replace(/bytes=/, "").split("-");
@tomilov
tomilov / springer-free-maths-books.sh
Created December 29, 2015 15:54 — forked from bishboria/springer-free-maths-books.md
Springer have made a bunch of books available for free, here are the direct links
wget http://link.springer.com/content/pdf/10.1007/978-1-4757-1779-2.pdf
wget http://link.springer.com/content/pdf/10.1007/978-1-4757-2103-4.pdf
wget http://link.springer.com/content/pdf/10.1007/978-1-4684-9884-4.pdf
wget http://link.springer.com/content/pdf/10.1007/978-3-662-02945-9.pdf
wget http://link.springer.com/content/pdf/10.1007/978-1-4612-9923-3.pdf
wget http://link.springer.com/content/pdf/10.1007/978-1-4757-3828-5.pdf
wget http://link.springer.com/content/pdf/10.1007/978-1-4684-9936-0.pdf
wget http://link.springer.com/content/pdf/10.1007/978-1-4419-8566-8.pdf
wget http://link.springer.com/content/pdf/10.1007/978-1-4757-4385-2.pdf
wget http://link.springer.com/content/pdf/10.1007/978-1-4419-8592-7.pdf