Skip to content

Instantly share code, notes, and snippets.

View elonmir's full-sized avatar

Markus Reisenhofer elonmir

  • BLUME2000 SE
  • Potsdam
  • 10:47 (UTC +02:00)
View GitHub Profile
const { Octokit } = require("@octokit/rest");
const config = require("./config.json");
// config = {
// "repositories": [
// {
// "slug": "owner/repository",
// "maintainers": [
// "TeamA",
// "TeamB"
@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!






\

@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 / multithread_downloads.py
Last active September 29, 2021 08:58
Download files from list parallel
import os
import sys
import logging
import argparse
import requests
from multiprocessing.pool import ThreadPool
def main(args):
links = open(args.filename, "r")
@elonmir
elonmir / bookmarklet.js
Created March 9, 2021 09:40
Bookmarklet for jira
javascript:(function(){let story = prompt('Add story ID', '');if('' !== story && null !== story){document.location = `https://enersis.atlassian.net/browse/${story}`;}})()
<!DOCTYPE html>
<!-- Template by html.am -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>3 Rows, 3 Columns A</title>
<style type="text/css">
body {
margin: 0;
@elonmir
elonmir / commit-msg
Last active May 19, 2022 09:02
Just write "YOLO" in your commit message to have some fun.
#!/bin/bash
RANDOM_MESSAGE_ORIGIN="http://whatthecommit.com/index.txt"
COMMIT_MSG=$(cat "${1:?Missing commit message file}")
if [[ $COMMIT_MSG = "YOLO" ]]
then
echo "$(curl -s $RANDOM_MESSAGE_ORIGIN) [randomly generated]" > .git/COMMIT_EDITMSG
fi
# 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