Skip to content

Instantly share code, notes, and snippets.

SELECT table,
formatReadableSize(sum(bytes)) as size,
min(min_date) as min_date,
max(max_date) as max_date
FROM system.parts
WHERE active
GROUP BY table
@elessarelfstone
elessarelfstone / wsl-cheatsheet.ps1
Created July 25, 2022 05:50 — forked from karthiks/wsl-cheatsheet.ps1
WSL 2 CLI Cheat-sheet To Be Run In Powershell
# To list installed distributions
wsl -l
wsl --list
# To list installed distributions along with its running status and wsl config being 1 or 2
wsl -l --verbose
wsl -l -v
# To run a specific distro
wsl -d distro_name
# change to postgres user and open psql prompt
sudo -u postgres psql postgres
# list databases
postgres=# \l
# list roles
postgres=# \du
# create role
@elessarelfstone
elessarelfstone / luigi_time_tasks_example.py
Created December 13, 2020 12:18 — forked from samuell/luigi_time_tasks_example.py
How to output the execution time of tasks in the luigi workflow system, as discussed [here](https://groups.google.com/d/msg/luigi-user/uivbf-luX9w/z0GCKKsIefoJ)
import luigi
import time
class TimeTaskMixin(object):
'''
A mixin that when added to a luigi task, will print out
the tasks execution time to standard out, when the task is
finished
'''
@luigi.Task.event_handler(luigi.Event.PROCESSING_TIME)
@elessarelfstone
elessarelfstone / django_cheat_sheet.md
Created September 9, 2019 05:06 — forked from bradtraversy/django_cheat_sheet.md
Django command cheat sheet

Django 2.x Cheat Sheet

Creating a virtual environment

We need to create a virtual env for our app to run in: More Here Run this command in whatever folder you want to create your venv folder

python -m venv ./venv
@elessarelfstone
elessarelfstone / django_deploy.md
Created September 9, 2019 05:04 — forked from bradtraversy/django_deploy.md
Django Deployment - Digital Ocean

Django Deployment to Ubuntu 18.04

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

Create A Digital Ocean Droplet

Use this link and get $10 free. Just select the $5 plan unless this a production app.

MySQL Cheat Sheet

Help with SQL commands to interact with a MySQL database

MySQL Locations

  • Mac /usr/local/mysql/bin
  • Windows /Program Files/MySQL/MySQL version/bin
  • Xampp /xampp/mysql/bin

Add mysql to your PATH

MongoDB Cheat Sheet

Show All Databases

show dbs

Show Current Database

@elessarelfstone
elessarelfstone / redis_cheatsheet.bash
Created September 9, 2019 04:57 — forked from LeCoupa/redis_cheatsheet.bash
Redis Cheatsheet - Basic Commands You Must Know --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
# Redis Cheatsheet
# All the commands you need to know
redis-server /path/redis.conf # start redis with the related configuration file
redis-cli # opens a redis prompt
# Strings.
@elessarelfstone
elessarelfstone / bash-essentials.sh
Created September 9, 2019 04:53 — forked from raineorshine/bash-essentials.sh
Bash Cheat Sheet: Just the Essentials (13 Commands). See https://gist.github.com/6927510 for more.
man COMMAND # Look up help for the given command
pwd # Print working directory
cd MYDIR # Change directory to MYDIR
cd ~/ # Change directory to user root (/Users/USERNAME)
cd .. # Change directory up a level
mkdir NEWDIR # Create a new directory in the current folder called NEWDIR
cp FROM_FILE TO_FOLDER # Copy FROM_FILE into TO_FOLDER
cp -r FROM_DIR TO_FOLDER # Copy FROM_DIR into TO_FOLDER