Skip to content

Instantly share code, notes, and snippets.

View SarthakNarayan's full-sized avatar

Sarthak Narayan SarthakNarayan

View GitHub Profile
@SarthakNarayan
SarthakNarayan / press_c_key_windows.py
Created May 20, 2023 21:10
Python code to keep pressing c key for windows
import ctypes
from ctypes import wintypes
import time
user32 = ctypes.WinDLL('user32', use_last_error=True)
INPUT_KEYBOARD = 1
KEYEVENTF_EXTENDEDKEY = 0x0001
KEYEVENTF_KEYUP = 0x0002
KEYEVENTF_KEYDOWN = 0x0000
KEYEVENTF_UNICODE = 0x0004
MAPVK_VK_TO_VSC = 0
@SarthakNarayan
SarthakNarayan / press_c_key.py
Created April 17, 2023 13:56
Using python to simulate a hardware key press in python on mac
# Installing the requried packages
# pip install pyobjc
# Code
import time
from Quartz.CoreGraphics import (
kCGEventKeyDown,
kCGEventKeyUp,
CGEventCreateKeyboardEvent,
CGEventPost,
@SarthakNarayan
SarthakNarayan / test.sh
Last active October 6, 2022 20:40
testing piping scripts
#!/bin/bash
vim_url=https://gist.githubusercontent.com/SarthakNarayan/ecc4aa39438cf86edbb3e65dbc597d3f/raw/59dcf7629872f554c1663da07762fbb94220d19c/.vimrc
curl -fsSL $vim_url > $HOME/.vimrc
@SarthakNarayan
SarthakNarayan / .vimrc
Last active September 10, 2022 04:43
Vim basic config
" ======================================================
" Basic Settings
syntax on
set tabstop=2
set number
set shiftwidth=2
set autoindent
set smartindent
set bg=dark
@SarthakNarayan
SarthakNarayan / udemy-firefox.js
Created May 14, 2022 07:23
Removing hover controls in udemy. Convert this into a bookmarklet to toggle the hover controls.
if (document.querySelector(".control-bar--control-bar-container--16vzi").style.visibility === "hidden"){
document.querySelector(".control-bar--control-bar-container--16vzi").style.visibility = "visible"
document.querySelector("div.user-activity--hide-when-user-inactive--pDPGx:nth-child(4)").style.visibility = "visible"
document.querySelector("div.next-and-previous--container--1bSoH:nth-child(2)").style.visibility = "visible"
document.querySelector("div.next-and-previous--container--1bSoH:nth-child(3)").style.visibility = "visible"
}
else {
document.querySelector(".control-bar--control-bar-container--16vzi").style.visibility = "hidden"
document.querySelector("div.user-activity--hide-when-user-inactive--pDPGx:nth-child(4)").style.visibility = "hidden"
document.querySelector("div.next-and-previous--container--1bSoH:nth-child(2)").style.visibility = "hidden"