Skip to content

Instantly share code, notes, and snippets.

View sharunkumar's full-sized avatar
💻
Working on new projects

Sharun sharunkumar

💻
Working on new projects
View GitHub Profile
@sharunkumar
sharunkumar / Keybase.io
Created August 14, 2018 17:53
Keybase Verification
### Keybase proof
I hereby claim:
* I am sharunkumar on github.
* I am sharunkumar (https://keybase.io/sharunkumar) on keybase.
* I have a public key ASBSekqzGALQs8Ki4rIXBoNiu0H5tYINN6wwNX078j-PsAo
To claim this, I am signing this object:
@sharunkumar
sharunkumar / Autohotkey New Windows Terminal.ahk
Last active June 17, 2020 19:33
Autohotkey script for hooking win+` to open and toggle to the new windows terminal. Terminal will be spawned if it isn't opened already.
#SingleInstance, force
global PreviousActiveWindow
; Requires windows terminal preview: https://www.microsoft.com/en-us/p/windows-terminal-preview/9n0dx20hk701
#`::
DetectHiddenWindows, On
if (WinExist("ahk_class CASCADIA_HOSTING_WINDOW_CLASS")) {
if(WinActive("ahk_class CASCADIA_HOSTING_WINDOW_CLASS")) {
@sharunkumar
sharunkumar / samsung-autodownload-app-remove
Created May 10, 2021 21:02
List of apps that were automatically downloaded on my old Samsung device which I tried to resurrect
pm uninstall -k --user 0 com.eterno
pm uninstall -k --user 0 com.king.candycrushsaga
pm uninstall -k --user 0 com.opera.max.oem
pm uninstall -k --user 0 com.opera.max.preinstall
pm uninstall -k --user 0 com.snapchat.android
pm uninstall -k --user 0 in.amazon.mShop.android.shopping
pm uninstall -k --user 0 in.mohalla.sharechat
pm uninstall -k --user 0 in.mohalla.video
class UnionFind {
private int[] root;
private int[] rank;
public UnionFind(int n) {
this.root = new int[n];
this.rank = new int[n];
for (int i = 0; i < n; ++i) {
this.root[i] = i;
this.rank[i] = 1;
}
class Solution {
public ListNode deleteMiddle(ListNode head) {
// Edge case: return nullptr if there is only one node.
if (head.next == null)
return null;
// Initialize two pointers, 'slow' and 'fast'.
ListNode slow = head, fast = head.next.next;
// Let 'fast' move forward by 2 nodes, 'slow' move forward by 1 node each step.
@sharunkumar
sharunkumar / Amazon.js
Last active February 26, 2023 03:21
Tampermonkey Scripts
// ==UserScript==
// @name Copy Job Description
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Adds a "Copy Job Description" button to amazon.jobs listing
// @author sharunkumar
// @match https://www.amazon.jobs/en/jobs/*/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=amazon.jobs
// @grant none
// ==/UserScript==
@sharunkumar
sharunkumar / SyncKeybindings.ps1
Created February 28, 2023 12:00
PowerShell script to copy the main keybindings to every profile in VSCode
cd $env:APPDATA\Code\User
Get-ChildItem .\profiles\ | % { copy .\keybindings.json "$_\keybindings.json" }
// https://www.geeksforgeeks.org/lexicographically-smallest-string-possible-by-using-given-operations/
// Given a string S consisting of digits from 0 to 9 inclusive, the task is to form the lexicographically
// smallest string by performing an operation any number of times. In one operation you can choose any
// position i and delete the digit d at s[i] and insert min(d+1, 9) on any position (at the beginning,
// at the end, or in between any two adjacent digits).
import java.io.*;
import java.util.*;
import java.util.PriorityQueue;
@sharunkumar
sharunkumar / IsomorphicStrings.java
Last active March 15, 2023 19:01
String Programs
// Java program to check if two strings
// areIsomorphic
import java.io.*;
import java.util.*;
class GFG {
static boolean areIsomorphic(String str1, String str2)
{
@sharunkumar
sharunkumar / BSTIterator.java
Last active March 22, 2023 19:27
Binary Search Trees
class BSTIterator {
Stack<TreeNode> stack;
public BSTIterator(TreeNode root) {
this.stack = new Stack<TreeNode>();
this._leftmostInorder(root);
}
private void _leftmostInorder(TreeNode root) {