Skip to content

Instantly share code, notes, and snippets.

View merwok's full-sized avatar
🍋
>>>

Éric merwok

🍋
>>>
View GitHub Profile
@danishabdullah
danishabdullah / Postgres kill all idle in transaction.md
Last active February 27, 2024 19:55
Postgres kill all idle in transaction

given a database named db:

SELECT pg_terminate_backend(pid) 
FROM pg_stat_activity 
WHERE datname='db'
  AND state = 'idle in transaction'
@namuol
namuol / INSTALL.md
Last active July 24, 2023 11:53
rage-quit support for bash

rage-quit support for bash

HOW TO INSTALL

Put flip somewhere in your $PATH and chmod a+x it.

Copy fuck into ~/.bashrc.

@colindean
colindean / displaylink_crunchbang_jessie.md
Last active January 23, 2023 21:25
HOWTO: Use a DisplayLink USB graphics adapter on Crunchbang Linux v11 Waldorf with partial upgrade to Debian Jessie
@jjdelc
jjdelc / list_filter_collapse.js
Created May 22, 2011 08:56
Collapse list_filter in Django admin
;(function($){
ListFilterCollapsePrototype = {
bindToggle: function(){
var that = this;
this.$filterEl.click(function(){
that.$filterList.slideToggle();
});
},
init: function(filterEl) {
this.$filterEl = $(filterEl).css('cursor', 'pointer');
@obeattie
obeattie / db_utils.py
Created October 14, 2009 12:51
Exposes SQLAlchemy's sessions and transactions as context managers (so they will be managed automatically inside blocks), and also provides a transaction decorator, which wraps an entire function in a transaction
"""Utilities for managing database sessions."""
from __future__ import with_statement
import contextlib
import functools
@contextlib.contextmanager
def temp_session(session_cls, **kwargs):
"""Quick and dirty context manager that provides a temporary Session object
to the nested block. The session is always closed at the end of the block.
@dergachev
dergachev / SPIN-selling.md
Last active July 17, 2022 03:03
SPIN Selling seminar
@wolever
wolever / wifi_and_power.rst
Created November 8, 2011 02:57
Wifi and power for medium sized tech events

This document is a practical checklist for anyone who needs to provide wifi and power for medium sized (10-100 attendants) tech events where attendees will expect to be able to plug in their laptops and get on a wireless network.

Full disclosure: I'm not an expert at this, but hopefully the things I've learned will be better than nothing.

General Notes

@lahwran
lahwran / programmingresources.md
Last active November 19, 2018 19:46
Programming learning resources

This list was originally authored by a friend who has been learning programming for some time (tuningmind)

Programming learning resources

Note: Many books may be available from a nearby public library. Check there as well!

These two are about the best I've seen for starting from scratch:

@pior
pior / pyramid_main.py
Last active April 12, 2017 15:37
Keep your deployment secrets out of your PasterDeploy configuration using Environment Variables
import os
from pyramid.config import Configurator
def main(global_config, **settings):
settings = {k: os.path.expandvars(v) for k, v in settings.items()}
config = Configurator(settings=settings)
config.include(__name__)
return config.make_wsgi_app()