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.core.exceptions import PermissionDenied | |
from django.utils.translation import ugettext as _ | |
from django.views.generic import TemplateView | |
from braces.views import JSONResponseMixin, LoginRequiredMixin | |
class JSONLoginRequiredMixin(LoginRequiredMixin, JSONResponseMixin): | |
""" |
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
# ~/.config/fish/config.fish: | |
# Shell integration breaks utilites like scp or rsync because of the excessive output. | |
# We will load it only if the shell is actually interactive. | |
if status --is-interactive | |
. $HOME/.iterm2_shell_integration.fish | |
end |
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
alias sww="iterm_bg_color 30 0 0; ssh web-production; iterm_bg_color 0 0 0" | |
alias swt="iterm_bg_color 0 20 20; ssh web-test; iterm_bg_color 0 0 0" | |
function iterm_bg_color() { | |
local tty=$(tty) | |
osascript -e " | |
tell application \"iTerm\" | |
repeat with theTerminal in terminals | |
tell theTerminal | |
try |
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
package main | |
import "fmt" | |
func main() { | |
hellotxt := ` | |
* * * * * * * * * * * * * * * * * * * * * * * * * | |
* goatse / hello.jpg world * | |
* * | |
* / \ \ / \ * | |
*| | \ | | * |
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
// ==UserScript== | |
// @name Slack: Full Name (@username) | |
// @namespace http://hatari.st/ | |
// @version 0.1 | |
// @description nuff said | |
// @author igor@hatari.st | |
// @match https://*.slack.com/messages/* | |
// ==/UserScript== | |
(function() { |
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 telegram import TelegramApi | |
from flask import Flask, request, jsonify | |
import settings | |
tg = TelegramApi(settings.API_TOKEN) | |
app = Flask(__name__) | |
tg.set_webhook(url=settings.BASE_URL + settings.WEBHOOK_URL) |
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 python3 | |
import asyncio | |
import aiohttp | |
import ujson | |
async def get(semaphore, session, url): | |
async with semaphore as sem: | |
return await session.get(url) |
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 sanic.exceptions import RequestTimeout | |
from sanic.server import HttpProtocol | |
class NoTimeoutHttpProtocol(HttpProtocol): | |
""" | |
Doesn't complain about request timeouts to the logger. | |
Usage: | |
app = Sanic() |
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
:) CREATE TABLE my_table (date Date DEFAULT today(), s String) ENGINE = MergeTree(date, (date), 8192); | |
:) INSERT INTO my_table (s) VALUES ('1. foo'); | |
:) ALTER TABLE my_table ADD COLUMN f Float64; | |
:) INSERT INTO my_table (s) VALUES ('2. bar'); | |
:) SELECT * FROM my_table; |
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 random | |
import sys | |
from netaddr import IPNetwork, IPAddress | |
def generate_random_ipv6(subnet): | |
network = IPNetwork(subnet) | |
return str(IPAddress(random.randrange(network.first, network.last))) |
OlderNewer