Skip to content

Instantly share code, notes, and snippets.

View webyneter's full-sized avatar
🎯
Focusing

Nikita Shupeyko webyneter

🎯
Focusing
View GitHub Profile
@tvlooy
tvlooy / rabbitmq.sh
Last active July 31, 2023 07:33
RabbitMQ add users configure queues
#!/bin/bash
VHOST=project
EXCHANGE=project-exchange
ADMIN_USER=admin
ADMIN_PASS=secret
MGMT_USER=mgmt
MGMT_PASS=secret
QUEUE1=queue1
QUEUE2=queue2
@nurtdinovadf
nurtdinovadf / 0. derived_aves table
Last active July 15, 2017 09:03
ITIS database queries
CREATE TABLE "public"."derived_aves" (
"complete_name" varchar(255),
"parent_tsn" int4 NOT NULL,
"rank_name" varchar(255) NOT NULL,
"tsn" int4 NOT NULL,
"rank_id" int4,
"level" int2,
"species" int4 NOT NULL,
"vernacular_names" json,
CONSTRAINT "derived_aves_pkey" PRIMARY KEY ("parent_tsn", "tsn", "species", "rank_name")
@bastman
bastman / docker-cleanup-resources.md
Created March 31, 2016 05:55
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@lukas-h
lukas-h / license-badges.md
Last active September 17, 2024 21:32
Markdown License Badges for your Project

Markdown License badges

Collection of License badges for your Project's README file.
This list includes the most common open source and open data licenses.
Easily copy and paste the code under the badges into your Markdown files.

Notes

  • The badges do not fully replace the license informations for your projects, they are only emblems for the README, that the user can see the License at first glance.

Translations: (No guarantee that the translations are up-to-date)

#!/bin/bash
#
# Compare two PDF files.
# Dependencies:
# - pdfinfo (xpdf)
# - pdfjam (texlive-extra-utils)
# - diffpdf
#
MAX_HEIGHT=15840 #The maximum height of a page (in points), limited by pdfjam.
@aseigneurin
aseigneurin / copy_remotely
Last active January 5, 2024 19:06
Ansible module to copy a file if the MD5 sum of the target is different
#!/usr/bin/python
DOCUMENTATION = '''
---
module: copy_remotely
short_description: Copies a file from the remote server to the remote server.
description:
- Copies a file but, unlike the M(file) module, the copy is performed on the
remote server.
The copy is only performed if the source and destination files are different
(different MD5 sums) or if the destination file does not exist.
@pkuczynski
pkuczynski / parse_yaml.sh
Last active September 23, 2024 01:42
Read YAML file from Bash script
#!/bin/sh
parse_yaml() {
local prefix=$2
local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034')
sed -ne "s|^\($s\)\($w\)$s:$s\"\(.*\)\"$s\$|\1$fs\2$fs\3|p" \
-e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 |
awk -F$fs '{
indent = length($1)/2;
vname[indent] = $2;
for (i in vname) {if (i > indent) {delete vname[i]}}
@jamesmfriedman
jamesmfriedman / rename_table_migration.py
Last active February 8, 2022 18:56
Renaming a Django app that has migrations already sucks. This Is a way I found to do it that preserves your old migration history and keeps your contenttypes in order. The trick is, this migration cannot be in the app you are migrating, so stick it in your "core" app or another app you have installed. Just plug in your own old and new app names.
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
from django.db.models import get_app, get_models
class Migration(SchemaMigration):
@agnoster
agnoster / README.md
Last active September 12, 2024 13:53
My ZSH Theme

agnoster.zsh-theme

A ZSH theme optimized for people who use:

  • Solarized
  • Git
  • Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)

For Mac users, I highly recommend iTerm 2 + Solarized Dark

@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active September 19, 2024 05:47
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%'