Skip to content

Instantly share code, notes, and snippets.

@techierishi
techierishi / vim.markdown
Created September 1, 2021 20:53 — forked from socketwiz/vim.markdown
Vim cheat sheet

motions

motion description
h Count characters left
l Count characters right
^ To the first character of the line
$ To the last character of the line
f<char> To the counth character occurrence to the right. F<char> to the counth character occurrence to the left
t<char> To 1 character just before the counth character occurrence to the right
@techierishi
techierishi / example.js
Created August 9, 2021 18:00 — forked from millermedeiros/example.js
execute multiple shell commands in series on node.js
// USAGE ------
// ============
var shell = require('./shellHelper');
// execute a single shell command
shell.exec('npm test --coverage', function(err){
console.log('executed test');
}});
@techierishi
techierishi / docker-compose.yaml
Last active July 2, 2021 19:33
Postgres DB and PG Admin
version: '3.5'
services:
postgres:
container_name: postgres_container
image: postgres
environment:
POSTGRES_DB: keenclouddb
POSTGRES_USER: ${POSTGRES_USER:-postgres}
@techierishi
techierishi / mac-clear-icon-cache.sh
Created June 23, 2021 14:58 — forked from ismyrnow/mac-clear-icon-cache.sh
Clear the icon cache on a Mac when you start seeing generic icons in Finder or the Dock
sudo rm -rfv /Library/Caches/com.apple.iconservices.store; sudo find /private/var/folders/ \( -name com.apple.dock.iconcache -or -name com.apple.iconservices \) -exec rm -rfv {} \; ; sleep 3;sudo touch /Applications/* ; killall Dock; killall Finder
const sleep = (ms) =>
new Promise(resolve => setTimeout(resolve, ms));
async function pageScript() {
document.querySelector('.custom-checkbox label div').click()
await sleep(1000);

Setting up a SSL Cert from Comodo

Purchasing a Comodo PositiveSSL cert via gogetssl.com and installing it on an Nginx server.

Purchase the cert

Prior to purchasing a cert, you need to generate a private key, and a CSR file

@techierishi
techierishi / index.js
Last active April 6, 2025 20:21
Utils
const plugins = new Plugins();
plugins.use((input, output, next) => { next(); });
plugins.use((input, output, next) => { next(); });
const input = {};
plugins.execute(input, null);
// Simplest ways to understand internal impl of useReducer
// Library
function useReducer(reducerFunc, initState) {
let currentState = initState;
let dispatchFunc = (action) => {
currentState = reducerFunc(currentState, action);
// console.log("currentState",currentState);
}
return [currentState, dispatchFunc]
// open aboute:logins
// open dev console and paste below code.
setInterval(()=>{
document.querySelector("login-item").shadowRoot.querySelector(".delete-button").click();
setTimeout(()=>document.querySelector("confirmation-dialog").shadowRoot.querySelector(".confirm-button.danger-button").click(), 100)
},300)
// Close tab after all passwords cleared
/*
var el = document.querySelector('html'),
elClone = el.cloneNode(true);
el.parentNode.replaceChild(elClone, el);
*/
document.addEventListener("click",handler,true);
function handler(e){