Skip to content

Instantly share code, notes, and snippets.

View darkman66's full-sized avatar

Hubert Piotrowski darkman66

View GitHub Profile
@mkczyk
mkczyk / .git-plugin-bash.sh
Last active May 13, 2024 06:59
Git aliases for bash (based on Oh My Zsh Git plugin)
#!/bin/bash
# To ~/.bashrc file add line:
# source ~/.git-plugin-bash.sh
# Based on Oh My Zsh Git plugin (without zsh functions):
# https://github.com/ohmyzsh/ohmyzsh/blob/master/plugins/git/git.plugin.zsh
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/git
#
@francirp
francirp / gist:b6676ab405f7f7dced0c
Last active December 5, 2023 02:04
Sublime Text Shortcuts for Mac

Critical Sublime Text Shortcuts (Mac)

Editing:

  • Copy: Command + C
  • Cut: Command + X
  • Paste: Command + V
  • Cursor to end of line: Command + Right Arrow
  • Cursor to beginning of line: Command + Left Arrow
@jhorman
jhorman / redis_semaphore.py
Last active April 13, 2022 12:39
Redis semaphore implemented in Python via zsets. Lock expiration is implemented by only scanning the zset for items within a time range.
from __future__ import absolute_import
from time import time, sleep
import uuid
class RedisSemaphore(object):
"""
Redis base semaphore. Supports timeouts of semaphore locks.
"""
@relekang
relekang / wsgi.py
Created February 12, 2013 22:18
django wsgi.py with new relic intialize
# -*- coding: utf-8 -*-
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings")
import newrelic.agent
newrelic.agent.initialize(os.path.join(os.path.dirname(os.path.dirname(__file__), 'newrelic.ini')
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active May 14, 2024 11:33
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%'