# Install pipenv
pip install pipenv
# Create Venv
pipenv shell
import os,sys,time | |
def get_size(start_path = '.'): | |
total_size = 0 | |
for dirpath, _, filenames in os.walk(start_path): | |
for file in filenames: | |
file_path = os.path.join(dirpath, file) | |
total_size += os.path.getsize(file_path) | |
return total_size |
<YouProject>.csproj | |
<Project Sdk="Microsoft.NET.Sdk"> | |
<PropertyGroup> | |
<OutputType>Exe</OutputType> | |
<TargetFramework>netcoreapp2.2</TargetFramework> | |
</PropertyGroup> | |
<ItemGroup> |
let getSeconds = secondsText => { | |
let spl = secondsText.split(':'); | |
return parseInt(spl[0]) * 60 + parseInt(spl[1]); | |
}; | |
let getEmbedUrl = url => { | |
let vIndex = url.indexOf('?v='); | |
let lIndex = url.indexOf('&list='); | |
return 'https://www.youtube.com/embed/' + url.substring(vIndex + 3, lIndex); | |
}; |
In this guide I will go through all the steps to create a VPS, secure it and deploy a Django application. This is a summarized document from this digital ocean doc
Any commands with "$" at the beginning run on your local machine and any "#" run when logged into the server
Use this link and get $10 free. Just select the $5 plan unless this a production app.
public sealed class Nester<T, TSortKey> : IDisposable | |
{ | |
private readonly IEnumerable<T> flatList; | |
private Func<T, T, bool> parentChildPredicate; | |
private PropertyInfo nestingPropertyInfo; | |
private Func<T, TSortKey> sortingKeySelector; | |
private Func<T, bool> rootLevelPredicate; | |
private Nester(IEnumerable<T> flatList, | |
Func<T, bool> rootLevelPredicate, |
function getRandomChar(isChar) { | |
return parseInt(Math.random() * 100) % (isChar === true ? 26 : 10); | |
} | |
function getRandomString(length) { | |
return [...new Array(length)] | |
.map((x, i) => | |
i % 2 === 0 ? | |
String.fromCharCode(65 + getRandomChar(true)).toString() : | |
getRandomChar(false).toString()) |
from requests import get | |
from requests.exceptions import RequestException | |
from contextlib import closing | |
from bs4 import BeautifulSoup | |
#Best used via Jupyter | |
def download_text(url): | |
try: | |
with closing(get(url, stream=True)) as resp: | |
if is_good_response(resp): |