Skip to content

Instantly share code, notes, and snippets.

@barbietunnie
barbietunnie / udemy-courses-download-using-cookies.md
Last active May 10, 2024 18:17
Downloading Udemy videos with youtube-dl

How to download your Udemy course videos using youtube-dl

$ youtube-dl --list-extractors | grep udemy

Steps

  1. Get link to the course to download. e.g. https://www.udemy.com/course-name/
  2. Login into udemy website, save the cookie from chrome using Chrome (Cookie.txt)[1] export extension. Save it to file udemy-cookies.txt
  3. Get the link of the video that you want to download. usually in format. Use the command provided below where you have to replace the {course_link} and {path_to_cookies_file} with respective paths.
$ youtube-dl {course_link} --cookies {path_to_cookies_file}

Useful Postgres Commands

1. Determine disk usage of a particular table/database

For a particular table,

SELECT pg_size_pretty( pg_total_relation_size('tablename') );
@barbietunnie
barbietunnie / custom-fonts-taliwindcss-nextjs.md
Last active May 5, 2024 21:33
How to Use Custom Fonts in TailwindCSS + NextJS

How to Use Custom Fonts in TailwindCSS + NextJS

Assuming your have already set up your NextJS + Tailwind project,

1. Select your desired custom Google font

2. Scroll to the bottom and select all the styles you are interested in

Select all your desired styles

@barbietunnie
barbietunnie / install-docker-centos-7.md
Created October 23, 2019 14:31
How To Install Docker and Docker Compose on CentOS 7

How To Install Docker and Docker Compose on CentOS 7

Step 1 — Install Docker

$ sudo yum check-update

$ curl -fsSL https://get.docker.com/ | sh

$ sudo systemctl start docker
@barbietunnie
barbietunnie / cool-adb-commands.md
Last active May 2, 2024 10:02
Helpful adb Commands

Helpful adb Commands

To simulate the phone being unplugged from usb charging you can use:

$ adb shell dumpsys battery set usb 0

or if you're on a device Android 6.0 or higher you can use:

$ adb shell dumpsys battery unplug

@barbietunnie
barbietunnie / stop-mac-apache.sh
Created February 25, 2017 22:42
Stop Default Apache server running on Mac OS Sierra
sudo apachectl stop
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist 2>/dev/null
@barbietunnie
barbietunnie / download-old-chrome-versions.md
Last active April 23, 2024 10:56
How to download old versions of Chrome

How to download old versions of Chrome

Click here to download old versions of Chrome for Linux, Mac and Windows.

The download_url field of the desired section houses the URL to the download.

Alternatively, for not too old versions, you can get it directly here.

@barbietunnie
barbietunnie / django-secret-key.py
Created December 5, 2022 04:06
How to generate a Django `SECRET_KEY`
from django.core.management.utils import get_random_secret_key
print(get_random_secret_key())
@barbietunnie
barbietunnie / dropbox-v2-upload.md
Created November 21, 2020 03:53
Upload Large Files with Dropbox v2

Upload Large Files with Dropbox v2

To upload large files with Dropbox, you need to use upload sessions.

The utility function below can be used for this purpose.

It uses the Dropbox Python SDK to upload the local file specified as file_path to the remote path specified by dest_path. It also chooses whether or not to use an upload session based on the size of the file.

@barbietunnie
barbietunnie / postgres-privileges.md
Last active March 21, 2024 14:50
Granting privileges in Postgres

Granting privileges in Postgres

Steps

Below are some common ways to grant access to a PostgreSQL user:

  1. Grant CONNECT to the database:
GRANT CONNECT ON DATABASE database_name TO username;