Skip to content

Instantly share code, notes, and snippets.

@mandeepsmagh
mandeepsmagh / init.lua
Last active April 16, 2022 12:55
Basic Neovim config to get started
-------------------- HELPERS -------------------------------
local cmd = vim.cmd -- to execute Vim commands e.g. cmd('pwd')
local fn = vim.fn -- to call Vim functions e.g. fn.bufnr()
local g = vim.g -- a table to access global variables
local opt = vim.opt -- to set options
local function map(mode, lhs, rhs, opts)
local options = {noremap = true}
if opts then options = vim.tbl_extend('force', options, opts) end
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
Assuming you have followed all the steps to install / setup WSL2 -> https://docs.microsoft.com/en-us/windows/wsl/install-win10
**Tested on Ubuntu 20.04**
Step 1 - Find out default gateway and DNS servers
- Navigate to `Control Panel\Network and Internet\Network Connections`
- Right click on relevant connection type WiFi or Ethernet and select `Status`
- Status screen will be displayed, click on `Details` button
- Network Connection details screen will be displayed
- Note down `IPv4 default gateway` and `IPv4 DNS Servers` if available

Here are some of my notes from Programming Rust. I'm posting them here and in a gist on github so they're searchable to me and anyone else that needs them, and show up in my search results.

Chapter 1

(omitted for brevity)

Chapter 2: Tour of Rust

  • Typical for function's return value to "fall off the end of the function"

  • Tests marked with #[test] attribute

@mandeepsmagh
mandeepsmagh / rename-and-zip
Created September 19, 2020 06:52
Powershell script to loop over files to rename and create individual zip copies
# Get all XML files - xml can be replaced with any other file extension
$files = Get-ChildItem *.xml -Recurse
# Loop over files to rename and create individual zip copies
foreach ($file in $files) {
# Get file name without xml extension
$zipFileName = (Get-Item $file).BaseName
# Get dir name for each file and append file name without extension
$combinedPath = $file.DirectoryName+'\'+$zipFileName
// Highcharts CheatSheet Part 1.
// Create interactive charts easily for your web projects.
// Download: http://www.highcharts.com/download
// More: http://api.highcharts.com/highcharts
// 1. Installation.
// Highcharts requires two files to run, highcharts.js and either jQuery, MooTools or Prototype or the Highcharts Standalone Framework which are used for some common JavaScript tasks.
// <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
// <script src="https://code.highcharts.com/highcharts.js"></script>