This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.urls import reverse | |
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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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.#'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<opml version="2.0"> | |
<head> | |
<title>Feeds</title> | |
</head> | |
<body> | |
<outline title="Home" text="Home"> | |
<outline xmlUrl="https://burningdaylight.io/rss.xml" title="burningdaylight" htmlUrl="https://burningdaylight.io" type="rss" text="burningdaylight" /> | |
<outline text="Rasa Malaysia: Easy Asian Recipes" title="Rasa Malaysia: Easy Asian Recipes" type="rss" xmlUrl="https://feeds2.feedburner.com/rasamalaysia" htmlUrl="http://rasamalaysia.com" /> | |
<outline htmlUrl="https://easyweeknight.com" title="Easy Weeknight" text="Easy Weeknight" type="rss" xmlUrl="https://easyweeknight.com/feed/" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
! Title: Search engine domains | |
! Description: Remove certain domains from Google/DuckDuckGo/Bing | |
! Low quality | |
duckduckgo.com##[data-domain*="geeksforgeeks.org"] | |
duckduckgo.com##[data-domain*="quora.com"] | |
duckduckgo.com##[data-domain*="stackshare.io"] | |
duckduckgo.com##[data-domain*="tutorialspoint.com"] | |
duckduckgo.com##[data-domain*="w3schools.com"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function nvm-fast | |
set -q NVM_DIR ; or set -l NVM_DIR ~/.nvm | |
set -l brigand_nvm_fish_path $NVM_DIR/versions/node | |
if test (count $argv[1]) -lt 1 | |
echo 'nvm-fast: at least one argument is required' | |
end | |
set -l command $argv[1] | |
if test $command = 'use' | |
set target_version "unknown" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am n0mn0m on github. | |
* I am n0mn0m (https://keybase.io/n0mn0m) on keybase. | |
* I have a public key ASAd41rUbkuAQ7OjrUNsD4motxK-XABjVPJBenph7zBE6Qo | |
To claim this, I am signing this object: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import PlaygroundSupport | |
import MetalKit | |
guard let device = MTLCreateSystemDefaultDevice() else { | |
fatalError("GPU Is Not Supported") | |
} | |
let frame = CGRect(x: 0, y: 0, width: 600, height: 600) | |
let view = MTKView(frame: frame, device: device) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//! Example based on the AutoFac 'getting started' example | |
//! (http://autofac.readthedocs.io/en/latest/getting-started/index.html) | |
use shaku::{module, Component, Interface}; | |
use std::sync::Arc; | |
module! { | |
pub AutoFacModule { | |
components = [ConsoleOutput, TodayWriter], | |
providers = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -euo pipefail | |
I don't normally use bash, but found this to be interesting: | |
The first statement is a Mac, GNU/Linux, and BSD portable way of finding the location of the bash interpreter. The second statement combines | |
“set -e” which ensures that your script stops on first command failure. By default, when a command fails, BASH executes the next command. Looking at the logs, you might feel that the script executed successfully while some commands might have failed. Caveat: Be careful about applying it to existing scripts. | |
“set -u” which ensures that your script exits on the first unset variable encountered. Otherwise, bash replaces the unset variables with empty default values. | |
“set -o pipefail” which ensures that if any command in a set of piped commands failed, the overall exit status is the status of the failed command. Otherwise, the exit status is the status of the last command. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" | |
"http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>org.gnu.emacs.daemon</string> | |
<key>ProgramArguments</key> | |
<array> | |
<string>/opt/local/bin/emacs</string> |
NewerOlder