Skip to content

Instantly share code, notes, and snippets.

View Abhinav1217's full-sized avatar

Abhinav Kulshreshtha Abhinav1217

View GitHub Profile
@Abhinav1217
Abhinav1217 / Microsoft.Powershell_profile.ps1
Created February 18, 2024 16:37
a basic $PROFILE for powershell
# Define an alias
#
# Set-Alias -Name backup-svn -Value {
# Param(
# [Alias('S')]
# [Parameter(Mandatory = $true)]
# [string] $SourcePath,
# [Alias('D')]
# [Parameter(Mandatory = $true)]
# [string] $DestinationPath
@Abhinav1217
Abhinav1217 / shell-tricks.sh.md
Created March 16, 2023 09:09
Some linux shell tricks

Remove audio tracks from video file.

function ffsilent { ffmpeg -i "$1" -c copy -an "${1%.*}-nosound.${1#*.}" }
@Abhinav1217
Abhinav1217 / useful-git-snippets.md
Last active February 23, 2023 04:19
Some useful git snippets for lesser used tasks

Taken from https://gist.github.com/lttlrck/9628955
Rename a branch both locally and on server.

git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote


git log --oneline -10 # Managable git log.

@Abhinav1217
Abhinav1217 / decorater-example.ts
Created February 6, 2023 15:24
General purpose "decorater" template for Typescript 5
/** Taken from Andrew Burgess YT video */
// https://www.youtube.com/watch?v=_1mQ_A7fq-g
function logged<
This,
Args extends any[],
Return,
Fn extends (this: This, ...args:Args) => Returns>
(
target: Fn,
@Abhinav1217
Abhinav1217 / powershell-snippets.ps1.md
Last active March 13, 2023 11:24
Some Usefull Powershell snippets for Linux users who are using windows for office work.

CRLF --> LF Recursively

PS > Get-ChildItem -File -Recurse | % { $x = get-content -raw -path $_.fullname; $x -replace "`r`n","`n" | set-content -path $_.fullname }

Force remove .git folder without any error

PS > Remove-Item -Recurse -Force 
@Abhinav1217
Abhinav1217 / Keybindings.json
Created January 24, 2023 03:10
code-oss configurations
// Place your key bindings in this file to override the defaults
[
// -- GENERAL SETUP
//
// I hate lru tab switching. Use `ctrl+p+p` for that.
{
"key": "ctrl+tab",
"command": "workbench.action.nextEditor"
},
{
@Abhinav1217
Abhinav1217 / ramblings.md
Created June 24, 2022 07:56 — forked from slimsag/ramblings.md
Because cross-compiling binaries for Windows is easier than building natively

Because cross-compiling binaries for Windows is easier than building natively

I want Microsoft to do better, want Windows to be a decent development platform-and yet, I constantly see Microsoft playing the open source game: advertising how open-source and developer friendly they are - only to crush developers under the heel of the corporate behemoth's boot.

The people who work at Microsoft are amazing, kind, talented individuals. This is aimed at the company's leadership, who I feel has on many occassions crushed myself and other developers under. It's a plea for help.

The source of truth for the 'open source' C#, C++, Rust, and other Windows SDKs is proprietary

You probably haven't heard of it before, but if you've ever used win32 API bindings in C#, C++, Rust, or other languages, odds are they were generated from a repository called microsoft/win32metadata.

@Abhinav1217
Abhinav1217 / HashSet.php
Created March 29, 2022 07:59
Simple Implementation of HashSet in php for quick hacks. Not recommended in actual works.
<?php
class HashSet
{
// PHP arrays are organized trees under the hood, also php provides better api's for dealing with keys.
// Hence we will use an arrays use it's keys for storing our nodes. Note PHP Arrays are always associative arrays.
private $set = [];
public function __construct($keys = [])
@Abhinav1217
Abhinav1217 / update-dart-sass.sh
Last active January 26, 2024 09:42
Install or Update Dart Sass in linux system.
#!/usr/bin/env bash
# Script to update dart-sass from official github release.
# Copyright (C) 2021 Abhinav Kulshreshtha
# Changelog
# 26th january 2024 fix for new URL format and recommended binary path practice.
# 05th october 2021 "updated with proper url"
@Abhinav1217
Abhinav1217 / search.sh
Created July 29, 2020 08:32 — forked from jonlabelle/search.sh
Bash script to search file contents (by file extension) for the specified search term. Uses grep under the hood.
#!/usr/bin/env bash
# shellcheck disable=SC2034,SC2086,SC2155,SC2001,SC2048
#
# Search file contents (by file extension) for the specified search term.
#
# grep options:
#
# -i Perform case insensitive matching.
# −r Recursively search subdirectories listed.