Skip to content

Instantly share code, notes, and snippets.

View vishes-shell's full-sized avatar
💭
🏄

Vishes vishes-shell

💭
🏄
View GitHub Profile
@RightHandedMonkey
RightHandedMonkey / jira_issue_copy_button.js
Last active May 18, 2023 12:11
JIRA Issue Copy Button (tampermonkey script) - Adds a copy button to JIRA issues for pasting into slack and others
// ==UserScript==
// @name Jira Issue Copy Button
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Add a copy button on the tickets so we can Copy ticket number and summary with just one click to share somewhere else
// @author Sam Bossen
// @match https://jira.audible.com/*
// @grant none
// ==/UserScript==
@annarailton
annarailton / pre-commit-autoflake.py
Last active September 20, 2020 19:10
Run autoflake against staged .py files on commit
#!/usr/bin/python3
"""Runs autoflake on commit. Blocks commit and requests adding changed files
if autoflake fires.
Installation
------------
1. You will need to install autoflake: https://pypi.org/project/autoflake/
$ pip install --upgrade autoflake
or
@vaughany
vaughany / log_min_duration_statement.md
Created October 8, 2018 16:16
Changing Postgres' log_min_duration_statement setting

Changing Postgres' log_min_duration_statement setting on the fly

Check the setting:

SELECT * FROM pg_settings WHERE name = 'log_min_duration_statement';

Change the setting:

SET log_min_duration_statement TO 1000; >

@egmontkob
egmontkob / Hyperlinks_in_Terminal_Emulators.md
Last active May 3, 2024 11:35
Hyperlinks in Terminal Emulators
@simonw
simonw / recover_source_code.md
Last active January 16, 2024 08:13
How to recover lost Python source code if it's still resident in-memory

How to recover lost Python source code if it's still resident in-memory

I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb
@zmts
zmts / tokens.md
Last active May 4, 2024 17:22
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Last major update: 25.08.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов
@QuantumGhost
QuantumGhost / example.puml
Last active March 23, 2024 22:39
A simple template for PlantUML to draw ER diagram.The basic idea comes from http://plantuml.sourceforge.net/qa/?qa=331/database-modeling
@startuml
' uncomment the line below if you're using computer with a retina display
' skinparam dpi 300
!define Table(name,desc) class name as "desc" << (T,#FFAAAA) >>
' we use bold for primary key
' green color for unique
' and underscore for not_null
!define primary_key(x) <b>x</b>
!define unique(x) <color:green>x</color>
!define not_null(x) <u>x</u>
@mattratleph
mattratleph / vimdiff.md
Last active April 24, 2024 11:28 — forked from roothybrid7/vimdiff_cheet.md
vimdiff cheat sheet

vimdiff cheat sheet

##git mergetool

In the middle file (future merged file), you can navigate between conflicts with ]c and [c.

Choose which version you want to keep with :diffget //2 or :diffget //3 (the //2 and //3 are unique identifiers for the target/master copy and the merge/branch copy file names).

:diffupdate (to remove leftover spacing issues)

:only (once you’re done reviewing all conflicts, this shows only the middle/merged file)

Introduction

  • C-a == Ctrl-a
  • M-a == Alt-a

General

:q        close
:w        write/saves
:wa[!]    write/save all windows [force]
:wq       write/save and close
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active May 3, 2024 16:53
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%'