Skip to content

Instantly share code, notes, and snippets.

@rubdos
rubdos / scalingd.service
Created January 18, 2024 22:25
sway automatic scaling on dock (for my Framework)
[Unit]
Description=Sway scaling daemon
[Service]
Environment=HOME=/home/rsmet/
ExecStart=/usr/bin/python /home/rsmet/.local/bin/sway-scaling-daemon.py
Restart=always
ExecStartPost=/bin/sleep 1
[Install]
@gabydd
gabydd / config.toml
Last active May 1, 2024 01:56
helix lf
[keys.normal]
C-f = [":new", ":insert-output lf-pick", "split_selection_on_newline", "goto_file", "goto_last_modification", "goto_last_modified_file", ":buffer-close!", ":theme nord", ":theme default"]
# replace the default after theme with the theme you use
# open 1 with the open command (l and <left> to open) or more with (<space> to select) then quit
# all opened files will be opened in helix
@benbacardi
benbacardi / gist:227f924ec1d9bedd242b
Last active February 13, 2024 20:53
Django reverse with a querystring
from django.utils.http import urlencode
def reverse_querystring(view, urlconf=None, args=None, kwargs=None, current_app=None, query_kwargs=None):
'''Custom reverse to handle query strings.
Usage:
reverse('app.views.my_view', kwargs={'pk': 123}, query_kwargs={'search': 'Bob'})
'''
base_url = reverse(view, urlconf=urlconf, args=args, kwargs=kwargs, current_app=current_app)
if query_kwargs:
return '{}?{}'.format(base_url, urlencode(query_kwargs))
@javierarilos
javierarilos / micro-mongodb-python-book.py
Created May 22, 2014 21:47
The Little MongoDB Book code examples written in Python + pymongo
##########################################################################
# THE MICRO MONGODB+PYTHON BOOK
#
# A simple adaptation to Python + summary of
# The Little MongoDB Book: https://github.com/karlseguin/the-little-mongodb-book
#
# javier arias losada
# twitter: @javier_arilos
# Usage suggestion: run line by line bu using pydemo project (https://github.com/pablito56/pydemo)
@aras-p
aras-p / preprocessor_fun.h
Last active April 28, 2024 15:25
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,