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 io | |
import weasyprint | |
from django.template.response import TemplateResponse | |
class PDFResponse(TemplateResponse): | |
def __init__(self, *args, **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
syntax on | |
set number | |
set relativenumber | |
highlight LineNr term=bold cterm=NONE ctermfg=DarkGrey ctermbg=NONE gui=NONE guifg=DarkGrey guibg=NONE |
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
class FilterCurrentUserMixin(object): | |
def get_queryset(self): | |
queryset = super(FilterCurrentUserMixin, self).get_queryset() | |
queryset = queryset.filter(user=self.request.user) | |
return queryset |
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 datetime | |
import io | |
import time | |
import picamera | |
from PIL import Image, ImageStat, ImageFont, ImageDraw | |
with picamera.PiCamera() as camera: |
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
#!/bin/bash | |
# de-fuck mysql 5.7 | |
# This script allow you to log on MySQL as root user without use sudo | |
# sudo apt install postgresql | |
# sudo apt purge "mysql-*" | |
# you know, would be better... | |
sudo mysql -u root -e "CREATE USER 'root2'@'localhost';" |
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
#!/bin/bash | |
set -x | |
EMAIL='' | |
API_KEY='' | |
ZONE_ID='' | |
RECORD_ID='' |
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
worker_processes auto; | |
worker_rlimit_nofile 8192; | |
user nginx; | |
pid /var/run/nginx.pid; | |
# error_log /var/log/nginx/error.log warn; | |
events { | |
worker_connections 2048; | |
multi_accept on; |
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
# -*- coding: utf-8 -*- | |
import mock | |
import requests | |
def make_request(): | |
try: | |
return requests.get('http://httpbin.org/ip').json()['origin'] |
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
# -*- coding: utf-8 -*- | |
import requests | |
API_URL = 'https://api.github.com/repos/{owner}/{repo}' | |
client = requests.Session() | |
client.auth = ('dvl', 'xx') | |
client.headers.update({ | |
'Accept': 'application/vnd.github.v3+json', |
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
user apache; | |
worker_processes auto; | |
worker_rlimit_nofile 8192; | |
pid /var/run/nginx.pid; | |
events { | |
worker_connections 2048; | |
multi_accept on; |
NewerOlder