Skip to content

Instantly share code, notes, and snippets.

View chirag64's full-sized avatar

Chirag Bhatia chirag64

View GitHub Profile
@chirag64
chirag64 / xrandr.sh
Last active April 29, 2024 12:57 — forked from debloper/xrandr.sh
Added license on user request
#!/bin/bash
# Copyright © 2021 Chirag Bhatia
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOF
@chirag64
chirag64 / SetWindowsGrubDefault.md
Created April 20, 2014 17:14
Set Windows as default entry in GRUB on Fedora
  • Open /etc/default/grub and ensure this line exists:

GRUB_DEFAULT=saved

  • Apply the change to grub.cfg by running:

grub2-mkconfig -o /boot/grub2/grub.cfg

  • Run this to set default to Windows
window.addEventListener('scroll', (evt) => {
const loadMoreBtn = document.querySelector('.loadMoreBtn');
if ((loadMoreBtn.offsetTop) < (scrollY + 1000)) {
loadMoreBtn.click();
}
});
@chirag64
chirag64 / PSSnippets.ps1
Last active May 11, 2023 22:32
PowerShell snippets
#Create array of file list from a directory.
$arr = (dir).FullName #Get all files
$arr = (dir *.log).FullName #Get files of .log extension
#Get headers of file to identify its format.
Get-Content -Path FilePath -Encoding Byte -TotalCount 4
#Download File via http.
Invoke-WebRequest "http://filepath/file.jpg" -OutFile "C:\LocalPath\filename.jpg"
@chirag64
chirag64 / Rust Frequent Operations.md
Last active January 20, 2023 14:06
Kind of like a cheat sheet

How to guide for frequent operations in Rust

For loop - vector

for i in my_vec {
    println!("Current item: {}", i);
}
### Merge two dataframes when both have a common column with common values (e.g. id)
pd.merge(df1, df2, how='inner', on='id')