Skip to content

Instantly share code, notes, and snippets.

View niazangels's full-sized avatar
🔥
Beast mode: ON

Niyas Mohammed niazangels

🔥
Beast mode: ON
View GitHub Profile
@niazangels
niazangels / easings.css
Created October 20, 2024 20:48
CSS Easing Bezier Curves
/* https://x.com/bdc */
:root {
--ease-in-quad: cubic-bezier(.55, .085, .68, .53);
--ease-in-cubic: cubic-bezier(.550, .055, .675, .19);
--ease-in-quart: cubic-bezier(.895, .03, .685, .22);
--ease-in-quint: cubic-bezier(.755, .05, .855, .06);
--ease-in-expo: cubic-bezier(.95, .05, .795, .035);
--ease-in-circ: cubic-bezier(.6, .04, .98, .335);
--ease-out-quad: cubic-bezier(.25, .46, .45, .94);
@niazangels
niazangels / cuda.sh
Created September 2, 2023 18:29
Install Cuda 11.8 on Ubuntu 22.04
# All steps taken from https://github.com/sytelus/pcprep/tree/master/ubuntu
# Remember to to "Enroll MOK" on UEFI when rebooting
# UNINSTALL EXISTING VERSIONS
# works for 11.8 and higher installed using deb file

Navigation

  • Home
  • Activities (@activity-listing)
  • Events (@event-listing)
  • About
  • Contact

Home

  • Hero
  • Upcoming events panels
@niazangels
niazangels / ffmpeg-compress.sh
Created January 29, 2023 17:51
Compress videos with ffmpeg
ffresize(){
for f in *.mp4 ; do ffmpeg -i "$f" -vf scale=854:480 "$f-480p.mp4" ; done
}
@niazangels
niazangels / crawler.py
Created April 12, 2022 20:57
Async python crawler with semaphore limit
# References:
# https://github.com/PrettyPrinted/youtube_video_code/blob/master/2020/12/31/How%20to%20Speed%20Up%20API%20Requests%20With%20Async%20Python/apiasync/script.py
# https://stackoverflow.com/questions/47934212/how-to-use-python-aiohttp-library-to-download-multiple-webpages
# https://pawelmhm.github.io/asyncio/python/aiohttp/2016/04/22/asyncio-aiohttp.html
import aiohttp
import aiofiles
import asyncio
URLS = [] # populate this
@niazangels
niazangels / multiple-undos-bank-account.py
Last active December 20, 2019 18:35
Command Design Pattern: Multiple undos
from abc import ABC
from enum import Enum
class BankAccount:
OVERDRAFT_LIMIT = -500
def __init__(self, balance=0):
self.balance = balance

Mistakes I've made in training deep neural networks

1. Using a Relu activation in the last layer for classification

nn.CrossEntropyLoss() would automatically apply a softmax over the last layer.

2. Backpropagating with an optimizer whose params were initialized with a different model

Especially in Jupyter Lab.

This is particularly weird because it won't raise any errors and your loss will appear to be stable and the model will not learn anything

@niazangels
niazangels / save_pdf_with_qpdf.py
Last active April 28, 2019 17:32
Save a pdf safely in python
# https://github.com/mstamy2/PyPDF2/issues/53
import os, shutil, tempfile
from pathlib import Path
# Things from the subprocess module don't rely on the shell unless you
# explicitly ask for it and can accept a pre-split list of arguments,
# making calling subprocesses much safer.
# (If you really do need to split quoted stuff, use shlex.split() instead)
from subprocess import check_call
# [...]
@niazangels
niazangels / key.md
Created February 28, 2019 14:10
Twitter (un)official Consumer Key

Twitter Official Consumer Key

Twitter for Android

type:            PIN
Consumer key:    3nVuSoBZnx6U4vzUxf5w
Consumer secret: Bcs59EFbbsdF6Sl9Ng71smgStWEGwXXKSjYvPVt7qys

Twitter for iPhone

type:            PIN

Consumer key: IQKbtAYlXLripLGPWd0HUA

@niazangels
niazangels / opencv4.sh
Created January 25, 2019 18:49
Cmake OpenCV4 for pipenv using Anaconda python3
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D INSTALL_C_EXAMPLES=OFF \
-D OPENCV_ENABLE_NONFREE=ON \
-D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules \
-D PYTHON_EXECUTABLE=~/.local/share/virtualenvs/kaggle-3VckuriQ/bin/python \
-D PYTHON_NUMPY_INCLUDE_DIR=~/.local/share/virtualenvs/kaggle-3VckuriQ/lib/python3.6/site-packages/numpy/core/include/ \
-D BUILD_opencv_python3=yes -D PYTHON_LIBRARY=/home/niyas/anaconda3/lib/libpython3.6m.so -D BUILD_EXAMPLES=ON ..