Skip to content

Instantly share code, notes, and snippets.

View postrational's full-sized avatar

Michał Karzyński postrational

View GitHub Profile
@postrational
postrational / settings.json
Created June 8, 2020 18:19
My first Windows Terminal settings file
// This file was initially generated by Windows Terminal 1.0.1401.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
@postrational
postrational / usr.share.X11.xkb.symbols.pc
Created December 2, 2019 17:21
xkb configuration to remap PgUp/PgDn to arrow keys and PrtSc to AltGr on ThinkPad keyboard (/usr/share/X11/xkb/symbols/pc)
default partial alphanumeric_keys modifier_keys
xkb_symbols "pc105" {
key <ESC> { [ Escape ] };
// The extra key on many European keyboards:
key <LSGT> { [ less, greater, bar, brokenbar ] };
// The following keys are common to all layouts.
key <BKSL> { [ backslash, bar ] };
@postrational
postrational / template.php
Created June 12, 2013 20:24
Drupal 7 - Redirect your users to a custom page after sending a message using site wide contact forms Place the following code in the template.php file of you theme.
<?php
function my_theme_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == 'contact_site_form') {
$form['#submit'][] = 'contact_form_submit_handler';
}
}
function contact_form_submit_handler(&$form, &$form_state) {
$form_state['redirect'] = 'thank-you-page-alias';
}
@postrational
postrational / gunicorn_start.bash
Last active April 4, 2024 12:48
Example of how to set up Django on Nginx with Gunicorn and supervisordhttp://michal.karzynski.pl/blog/2013/06/09/django-nginx-gunicorn-virtualenv-supervisor/
#!/bin/bash
NAME="hello_app" # Name of the application
DJANGODIR=/webapps/hello_django/hello # Django project directory
SOCKFILE=/webapps/hello_django/run/gunicorn.sock # we will communicte using this unix socket
USER=hello # the user to run as
GROUP=webapps # the group to run as
NUM_WORKERS=3 # how many worker processes should Gunicorn spawn
DJANGO_SETTINGS_MODULE=hello.settings # which settings file should Django use
DJANGO_WSGI_MODULE=hello.wsgi # WSGI module name
@postrational
postrational / example-drupal.nginxconf
Last active December 18, 2015 05:29
Nginx virtual server configuration for Drupal
server {
server_name example.com; ## <-- Your domain.
root /webapps/example-drupal; ## <-- Path to your Drupal files.
# Enable compression, this will help if you have for instance advagg module
# by serving Gzip versions of the files.
gzip_static on;
location / {
try_files $uri @rewrite;