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 datetime import datetime, timedelta | |
from django.core.management.base import NoArgsCommand | |
from django.contrib.sessions.models import Session | |
from django.db.transaction import commit | |
class Command(NoArgsCommand): | |
def handle_noargs(self, **options): | |
""" the conventional django cleanup method crashes when there's a few million records in django_sessions | |
so, do this without crashing. |
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 nodejs | |
const puppeteer = require('puppeteer'); | |
function get_url(url, headless){ | |
return new Promise(async function(resolve, reject){ | |
const browser = await puppeteer.launch({headless: headless}); | |
const page = await browser.newPage(); | |
page.setViewport({'width':1920, 'height':1080}); | |
page.goto(url).then(async 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
#################### | |
# Can you solve the frog problem? | |
# Regarding the video: https://www.youtube.com/watch?v=ZLTyX4zL2Fc | |
# By: Aaron Mader | |
# | |
# Note: This code doesn't actually NEED to be recursive, you could just iterate your way up from 1 to n. | |
# But your fractions will get pretty large (around n=500) before you run out of recursion depth | |
# (which happens at n=1000), so it doesn't really matter. | |
#################### |