-
Install the the
shadowsocks-libevpackage from apt repository.sudo apt update sudo apt install shadowsocks-libev -
Save
ss.jsonas/etc/shadowsocks-libev/config.json.
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 UserSerializer(serializers.ModelSerializer): | |
| profile = ProfileSerializer() | |
| class Meta: | |
| model = User | |
| fields = ('username', 'email', 'profile') | |
| def create(self, validated_data): | |
| profile_data = validated_data.pop('profile') | |
| user = User.objects.create(**validated_data) |
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
| package main | |
| import ( | |
| "log" | |
| "github.com/gorilla/websocket" | |
| ) | |
| type Message struct { | |
| Action string `json:"action"` |
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
| """ | |
| MONGODB = { | |
| 'default': { | |
| 'NAME': env('MONGODB_DEFAULT_DATABASE', default='scanvis'), # Default database to connect to | |
| 'URI': env('MONGODB_URI', default='mongodb://localhost:27017/') | |
| } | |
| } | |
| """ | |
| from django.conf import settings | |
| from pymongo import MongoClient |
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
| #!/usr/bin/env bash | |
| version=$1 | |
| if [ ! -d "~/.pyenv/cache" ]; then | |
| mkdir -p ~/.pyenv/cache | |
| fi | |
| wget http://mirrors.sohu.com/python/$version/Python-$version.tar.xz -P ~/.pyenv/cache | |
| pyenv install -v $version |
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
| # http://editorconfig.org | |
| root = true | |
| [*] | |
| charset = utf-8 | |
| end_of_line = lf | |
| insert_final_newline = true | |
| trim_trailing_whitespace = true |
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 asyncio | |
| import aiomysql | |
| from aiomysql.cursors import DictCursor | |
| class MysqlWrapper: | |
| def __init__(self, host, port, user, password, db): | |
| self.host = host | |
| self.port = port |
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 flask import Flask | |
| class Config: | |
| DEBUG = True | |
| def __getattribute__(self, item): | |
| if item in os.environ: | |
| return os.environ[item] | |
| return object.__getattribute__(self, item) | |
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 asyncio | |
| async def task(): | |
| while True: | |
| print('Do something.') | |
| await asyncio.sleep(1) | |
| async def run(lp): |
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 fabric.api import env, cd, sudo, run | |
| env.user = 'user' | |
| env.hosts = ['192.168.0.2'] | |
| env.password = '123456' | |
| env.prompts = { | |
| 'continue connecting (yes/no)? ': 'yes', | |
| 'password: ': env.password | |
| } |