Skip to content

Instantly share code, notes, and snippets.

View karansinghgit's full-sized avatar
🎯
Focusing

Karan Singh karansinghgit

🎯
Focusing
  • Singapore
View GitHub Profile

apt vs apt-get:

apt-get and apt-cache's most commonly used commands are available in apt.

Update vs Upgrade(apt):

You should first run update, then upgrade. Neither of them automatically runs the other.

apt-get update updates the list of available packages and their versions, but it does not install or upgrade any packages. apt-get upgrade actually installs newer versions of the packages you have. After updating the lists, the package manager knows about available updates for the software you have installed. This is why you first want to update. Additionally, you can use apt-get update && apt-get upgrade to do both steps after each other.

@karansinghgit
karansinghgit / NodeSetupWSL.md
Last active June 29, 2020 09:05
How to Setup Node on WSL

DO NOT INSTALL NODE.JS FROM THE WEBSITE

If you happen to have previous installations, uninstall them before proceeding any further.

  1. Do a manual install of NVM from here.

    Currently the instructions are:

    export NVM_DIR="$HOME/.nvm" && (
      git clone https://github.com/nvm-sh/nvm.git "$NVM_DIR"
    
  1. npm init in the project folder

  2. npm install webpack webpack-cli webpack-dev-server -g

  3. npm install babel-loader @babel/core @babel/preset-env @babel/preset-react --save-dev

  4. Create webpack.config.js in main folder:

    const path = require('path');
    
    module.exports = {
    

entry: './index.js',

  1. Remove any existing versions for a clean slate:
sudo apt-get remove golang-go
sudo apt-get remove --auto-remove golang-go
  1. Download and Install. Here I install version 1.14.2:
wget https://dl.google.com/go/go1.14.2.linux-amd64.tar.gz
sudo tar -xvf go1.14.2.linux-amd64.tar.gz
  1. npx create-react-app my-app
  2. cd my-app
  3. npm install tailwindcss --save-dev
  4. Either tailwind init tailwind.config.js or ./node_modules/.bin/tailwind init tailwind.config.js
  5. touch src/css/tailwind.src.css and paste it:
@tailwind base;
@tailwind components;
@tailwind utilities;
@karansinghgit
karansinghgit / main.go
Created June 9, 2020 13:41
Creating an API using mux: How can I refactor this code?
package main
import (
"context"
"encoding/json"
"fmt"
"net/http"
"strings"
"time"
  1. sudo apt-get install mysql-server
  2. service mysql restart
  3. sudo mysql -u root -p
@karansinghgit
karansinghgit / Useful MySQL Commands.md
Last active June 26, 2020 18:24
Commonly Used MySQL commands for basic use-cases

USER RELATED

  • CREATE USER create user karan@localhost identified by 'password';
  • VIEW ALL USERS select user, host from mysql.user;
  • VIEW CURRENT USER select user();
  • DROP USER drop user karan@localhost
  • GRANT PRIVELEGES
@karansinghgit
karansinghgit / del_vscode_mac.md
Last active October 30, 2024 01:30
How to completely uninstall VSCode on Mac
  1. Close and Quit VSCode

  2. Remove VScode from Applications (just go to Finder -> Applications and move VSCode to Bin)

  3. Execute these commands in any order. The paths might be slightly different for you.

rm -fr ~/.vscode*
rm -fr ~/Library/Application\ Support/Code/

rm -fr ~/Library/Saved\ Application\ State/com.microsoft.VSCode.savedState/
rm -fr ~/Library/Preferences/com.microsoft.VSCode.helper.plist