This file contains hidden or 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.core.management.commands import makemigrations | |
class Command(makemigrations.Command): | |
def handle(self, *args, **options): | |
self.stdout.write(self.style.HTTP_NOT_FOUND( | |
'This is the overridden command that always creates a migration ' | |
'with the name "m", by which we can catch conflicts at the level ' | |
'of the Pull Request.' |
This file contains hidden or 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
curl -q 'http://watchout4snakes.com/wo4snakes/Random/RandomPhrase' -H 'Origin: http://watchout4snakes.com' -X POST --data 'Pos1=a&Level1=35&Pos2=n&Level2=35' | trans en:pl |
This file contains hidden or 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
""" | |
Sloppy but colorful thesaurus.com for CLI | |
Requires Python 3.6 | |
Usage: | |
pip install ansicolors pyquery | |
python thesaurus.py private | |
""" |
This file contains hidden or 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
var request = require('request'); | |
console.log('With callbacks'); | |
var browser = 'Selenium Wrapper'; | |
function getIp (callback) { | |
request('https://api.ipify.org?format=json', function (error, response, body) { | |
if (error) { | |
throw `Cannot connect: ${error}`; |
This file contains hidden or 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 sys | |
import pyquery | |
import requests | |
SYNONIMY_URL = 'https://www.synonimy.pl/synonim/{}/' | |
WORDS_PER_LINE = 5 | |
if len(sys.argv) < 2: |
This file contains hidden or 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
class InstanceOf: | |
"""Wrapper to compare only type, not whole instance. | |
Example usage: | |
def test_ok(m_ted): | |
... | |
m_ted.assert_called_once_with(InstanceOf(NotificationRequest)) | |
""" |
This file contains hidden or 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
// ==UserScript== | |
// @name 1337x.to search results have filmweb links | |
// @include http://1337x.to/* | |
// @version 0.1 | |
// @description Add new column in search results that target to Filmweb's movie page. | |
// @author avalanchy | |
// ==/UserScript== | |
(function() { |
This file contains hidden or 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
def _uppercase_for_dict_keys(lower_dict): | |
upper_dict = {} | |
for k, v in lower_dict.items(): | |
if isinstance(v, dict): | |
v = _uppercase_for_dict_keys(v) | |
upper_dict[k.upper()] = v | |
return upper_dict | |
def test(): |
This file contains hidden or 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
def _uppercase_for_dict_keys(lower_dict): | |
upper_dict = {} | |
for k, v in lower_dict.items(): | |
if isinstance(v, dict): | |
v = _uppercase_for_dict_keys(v) | |
upper_dict[k.upper()] = v | |
return upper_dict |
This file contains hidden or 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
def reverse_qs(*args, **kwargs): | |
"""Overwritten django reverse function which additionally allows | |
to construct query string for an URL. | |
New kwargs: | |
* `params` a normal python dict. | |
* `q_dict` a QueryDict instance. | |
* `q_string` a query string same as in URL. | |
Examples of usage: |