# set http proxy
export http_proxy=http://PROXYHOST:PROXYPORT
# set http proxy with user and password
export http_proxy=http://USERNAME:PASSWORD@PROXYHOST:PROXYPORT
# set http proxy with user and password (with special characters)
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
| Once after connecting VPN, ssh getting disconnected because, ssh traffic from the server going via VPN server. So to avoid this run the following command before connecting VPN. | |
| 1. Solution 1 (BUt its IP address dependent from which the ssh connection is being made to VPS - Try this at end. Go for Solution 2): | |
| route add -host your-machine-public-ip gw Server-gatway-ip dev eth0 | |
| your-machine-public-ip : IP of your machine from where you are doing SSH. Server-gatway-ip: Gatway/router's IP of that server | |
| The above command will redirect the traffic via the given gateway not through VPN Server. |
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 os | |
| import asyncio | |
| import aiohttp # pip install aiohttp | |
| import aiofile # pip install aiofile | |
| REPORTS_FOLDER = "reports" | |
| FILES_PATH = os.path.join(REPORTS_FOLDER, "files") | |
| def download_files_from_report(urls): |
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
| # List databases | |
| sudo su postgres | |
| psql | |
| \list | |
| # Create a compressed backup | |
| sudo su postgres | |
| pg_dump -Fc <database_name> > <file> | |
| # Example |
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
| # clone git | |
| git clone https://github.com/golang/go | |
| cd go | |
| # checkout the correct commit for the patch | |
| git checkout bad5abf64d76f9c302c084c5f62e6f70920d3c81 | |
| # apply the patch | |
| git apply mips_softfloat.patch | |
| # build go | |
| cd src | |
| ./all.bash |
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 python | |
| import argparse | |
| def main(command_line=None): | |
| parser = argparse.ArgumentParser('Blame Praise app') | |
| parser.add_argument( | |
| '--debug', | |
| action='store_true', | |
| help='Print debug info' |
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/python | |
| import socket, os, select, struct | |
| import errno | |
| import logging | |
| from logging import info, warn, error | |
| logging.root.setLevel(logging.INFO) |
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 rest_framework.permissions import BasePermission, SAFE_METHODS | |
| class IsAdminOrReadOnly(BasePermission): | |
| def has_permission(self, request, view): | |
| if request.method in SAFE_METHODS: | |
| return True | |
| else: | |
| return request.user.is_staff |
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 ( | |
| "fmt" | |
| "image" | |
| "image/color" | |
| "image/gif" | |
| "math" | |
| "os" | |
| ) |
NewerOlder