Skip to content

Instantly share code, notes, and snippets.

@anvk
anvk / psql_useful_stat_queries.sql
Last active April 23, 2024 03:15
List of some useful Stat Queries for PSQL
--- PSQL queries which also duplicated from https://github.com/anvk/AwesomePSQLList/blob/master/README.md
--- some of them taken from https://www.slideshare.net/alexeylesovsky/deep-dive-into-postgresql-statistics-54594192
-- I'm not an expert in PSQL. Just a developer who is trying to accumulate useful stat queries which could potentially explain problems in your Postgres DB.
------------
-- Basics --
------------
-- Get indexes of tables
@runspired
runspired / form.html
Created May 23, 2016 13:46
How to turn off password and email/username autocomplete.
<!--
<form autocomplete="off"> will turn off autocomplete for the form in most browsers
except for username/email/password fields
-->
<form autocomplete="off">
<!-- fake fields are a workaround for chrome/opera autofill getting the wrong fields -->
<input id="username" style="display:none" type="text" name="fakeusernameremembered">
<input id="password" style="display:none" type="password" name="fakepasswordremembered">
@amatellanes
amatellanes / celery.sh
Last active April 19, 2024 11:31
Celery handy commands
/* Useful celery config.
app = Celery('tasks',
broker='redis://localhost:6379',
backend='redis://localhost:6379')
app.conf.update(
CELERY_TASK_RESULT_EXPIRES=3600,
CELERY_QUEUES=(
Queue('default', routing_key='tasks.#'),
@mcxiaoke
mcxiaoke / index.html
Created July 3, 2014 03:53 — forked from davidwkeith/index.html
detect app installed in browser
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>App Redirection</title>
</head>
<body>
<!-- iframe used for attempting to load a custom protocol -->
<iframe style="display:none" height="0" width="0" id="loader"></iframe>
@soheilhy
soheilhy / nginxproxy.md
Last active March 22, 2024 08:54
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@hjpotter92
hjpotter92 / .rcbash
Last active May 23, 2016 08:12
Git Bash profile settings.
source ~/git-prompt.sh
source ~/git-completion.bash
export GIT_PS1_SHOWDIRTYSTATE=true
export GIT_PS1_SHOWUNTRACKEDFILES=true
export GIT_PS1_SHOWSTASHSTATE=true
export GIT_PS1_SHOWUPSTREAM=verbose
PS1=$'\[\e[0m\]\u250c\u2500[$([[ $? != 0 ]] && echo "\[\e[1;31m\]\u2717\[\e[0m\]" || echo "\[\e[1;32m\]\u2714\[\e[0m\]")]\u2500[\[\e[0m\]\[\e[1;36m\]\u\[\e[0m\]@\[\e[1;35m\]\h\[\e[0m\]]\u2500[\[\e[4;33m\]\W\[\e[0m\]]\u2500[\[\e[1;33m\]\@\[\e[0m\]]\[\e[0m\]$(__git_ps1)\n\[\e[0m\]\u2514\u2500\u2500\[\e[1;36m\]\$\[\e[0m\] '
# custom alias list
# ls, clear etc.
@kapkaev
kapkaev / gist:4619127
Created January 24, 2013 09:30
MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error. Resque
$ redis-cli
> config set stop-writes-on-bgsave-error no
@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%'

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name: