Skip to content

Instantly share code, notes, and snippets.

View elonmir's full-sized avatar

Markus Reisenhofer elonmir

  • BLUME2000 SE
  • Potsdam
  • 13:45 (UTC +01:00)
View GitHub Profile
# get total requests by status code
awk '{print $9}' /var/log/nginx/access.log | sort | uniq -c | sort -rn
# get top requesters by IP
awk '{print $1}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head | awk -v OFS='\t' '{"host " $2 | getline ip; print $0, ip}'
# get top requesters by user agent
awk -F'"' '{print $6}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head
# get top requests by URL
@elonmir
elonmir / postgres_queries_and_commands.sql
Created October 11, 2021 14:55 — 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%'
@elonmir
elonmir / The Technical Interview Cheat Sheet.md
Created May 13, 2022 12:13 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

ANNOUNCEMENT

I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!






\

const { Octokit } = require("@octokit/rest");
const config = require("./config.json");
// config = {
// "repositories": [
// {
// "slug": "owner/repository",
// "maintainers": [
// "TeamA",
// "TeamB"