Skip to content

Instantly share code, notes, and snippets.

View danialmalik's full-sized avatar
🎮

Danial Malik danialmalik

🎮
View GitHub Profile
@danialmalik
danialmalik / launch.json
Created November 17, 2020 12:56
VS code configurations for using the debugger with create-react-app scripts tests.
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug CRA Tests",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/node_modules/.bin/react-scripts",
"args": ["test", "${relativeFile}", "--runInBand", "--no-cache", "--watchAll=false"],
@danialmalik
danialmalik / Instructions.md
Created October 27, 2020 05:46
Install Linux mint on Asus Tuf A15 (AMD 4600H CPU + Nvidia GTX 1650 4GB)
  • Make bootable usb drive

  • Disable secure boot and fast boot from BIOS settings

  • Boot into USB

    • EITHER:
      • from Grub menu, press 3 and add "acpi=off" parameter to linux command.
      • press ctrl+x to boot
    • OR:
      • Boot in compatibility mode
  • Install Linux (currently trackpad is not working ATM so use an external mouse)

@danialmalik
danialmalik / delete bulk git branches.sh
Created November 21, 2019 11:02
delete bulk git branches.
### Step by step breakdown ####
# Display branches from one remote
# git ls-remote --heads origin | sed 's?.*refs/heads/??'
# Exclude the master branch
# git ls-remote --heads origin | sed 's?.*refs/heads/??' | grep -v 'master'
# Exclude the many branch
# git ls-remote --heads origin | sed 's?.*refs/heads/??' | grep -v 'master\|develop\|branch3'
@danialmalik
danialmalik / mysql-docker.sh
Created October 28, 2019 07:21 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@danialmalik
danialmalik / download_from_google_drive.sh
Created August 28, 2019 16:45
Download Large files from google drive
# Copy the file ID from the url and put in the command below
wget --save-cookies cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=__FILEID__' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/Code: \1\n/p'
# Command Above will return a Code . use that code in the command below.
wget --load-cookies cookies.txt 'https://docs.google.com/uc?export=download&confirm=__CODE__&id=__FILEID__'
@danialmalik
danialmalik / convert.sh
Created August 19, 2019 16:30
Convert camelCase variable names into snake_case
sed -r 's/([a-z]+)([A-Z][a-z]+)/\1_\l\2/g' file.txt
@danialmalik
danialmalik / patch.sh
Created August 19, 2019 16:29
Commands to make separate git patches for every file in a dir. (Codemod alternative)
git diff --name-only | xargs -I{} sh -c 'git diff {} > {}.patch'
ls ./**/*.patch | xargs -I{} sh -c 'git apply {}'
@danialmalik
danialmalik / pip_install_uninstall.sh
Last active July 8, 2019 09:47
pip install/uninstall without interrupting on a single error.
# use sudo to remove packages install through root user
[sudo] cat requirements/development.txt | xargs -n 1 [sudo] pip [install | uninstall] -y
@danialmalik
danialmalik / philu_vagrant_ssh_fix
Last active June 20, 2019 06:54
Fix for philu vagrant box error with ssh. 'Authentication Failure'
If you cannot ssh into vagrant box and it requires a password everytime. use following commands:
```sh
ssh-keygen -f ~/.vagrant.d/insecure_private_key
ssh-copy-id -i ~/.vagrant.d/insecure_private_key -p 2222 [email protected]
```
@danialmalik
danialmalik / install_devstack.sh
Created April 1, 2019 12:39
Openedx devstack installation
makedir ~/work/arbisoft/ucsd/edx -p
cd ~/work/arbisoft/ucsd
virtualenv env
source env/bin/activate
mkdir edx
cd edx
git clone https://github.com/edx/devstack.git