Skip to content

Instantly share code, notes, and snippets.

View ashwin-pc's full-sized avatar

Ashwin P Chandran ashwin-pc

View GitHub Profile
@ashwin-pc
ashwin-pc / contributing your first PR.md
Last active October 28, 2023 11:43
Contributing your first OpenSearch PR

Contributing your first PR

1. Installing Git

  • For Windows: Git for Windows
  • For Mac: Use Homebrew (brew install git) or download from Git website
  • For Linux:
    sudo apt-get update
    sudo apt-get install git
    
@ashwin-pc
ashwin-pc / pr_assignee.py
Created June 28, 2023 01:58
Github stat scripts
import requests
import json
# Get the codeowners for the specified repository
url = "https://api.github.com/repos/opensearch-project/OpenSearch-Dashboards/contents/.github/CODEOWNERS"
response = requests.get(url)
codeowners_file = response.content.decode("utf-8")
codeowners_json = json.loads(codeowners_file)
@ashwin-pc
ashwin-pc / setup.sh
Last active May 1, 2023 05:16
Setup Wifi Connect
#!/bin/bash
# Step 1: Install WIFI Connect
if [[ "$(uname -m)" == "aarch64" ]]; then
curl -L https://github.com/balena-io/wifi-connect/raw/master/scripts/raspbian-install.sh | sed 's/\*rpi/*aarch64/' | bash
else
bash <(curl -L https://github.com/balena-io/wifi-connect/raw/master/scripts/raspbian-install.sh)
fi
# Step 2: Create the wifi-connect.service file
@ashwin-pc
ashwin-pc / main.js
Created December 13, 2022 06:42
Toggle Github Notifications based on icon class names
function main () {
// get the classes from session storage
const classes = sessionStorage.getItem('classes') ? sessionStorage.getItem('classes').split(', ') : ['octicon-git-merge'];
const parentClass = 'notifications-list-item'
let elements = [];
// prompt the user if the classes array is correct
const response = prompt(`Are these the classes you want to select?`, classes.join(', '));
// convert comma separated string to array, also trim the spaces and remove empty strings
{
"version": "1.0",
"id":"github-gist",
"title":"Github Gist",
"url":"https://gist.githubusercontent.com/ashwin-pc/a43f54a17ff2f2f9d04b3c191715f56a/raw",
"featured": [
{
"name": "Sample github config",
"background": "/assets/card.png",
"link": "http://google.com"
@ashwin-pc
ashwin-pc / addLocationChangeEvents.js
Last active October 14, 2022 21:03
User Script utils
// Modifies the history object to add functionality for url changes.
// This allows us to detect when someone clicks on a ticket from
// the ticket list or clicks on a tab in the ticket details page and
// trigger an event.
const LOCATION_CHANGE_EVENT = 'locationchange';
function addLocationChangeEvents(eventName = LOCATION_CHANGE_EVENT) {
history.pushState = ((f) =>
function pushState() {
var ret = f.apply(this, arguments);
@ashwin-pc
ashwin-pc / init.lua
Last active January 22, 2023 16:50
Macro recipe for Hammerspoon
local macro = require('macro')
-- Macro 1
hs.hotkey.bind({}, "f13", function() macro.run(1) end)
hs.hotkey.bind({}, "f14", function() macro.clear(1) end)
-- Macro 2
hs.hotkey.bind({}, "f15", function() macro.run(2) end)
hs.hotkey.bind({}, "f16", function() macro.clear(2) end)
@ashwin-pc
ashwin-pc / githubRaw.js
Created January 13, 2020 07:43
Userscript Github Raw Links
// ==UserScript==
// @name Generate Raw Links
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Generate download links to the raw files
// @author ashwin-pc
// @match https://github.com/*
// @grant none
// ==/UserScript==
@ashwin-pc
ashwin-pc / addToast.js
Last active March 5, 2020 07:48
Add Toast Bookmaklet
(function() {
var linkNode = document.createElement("link");
linkNode.rel = "stylesheet";
linkNode.href = "https://cdn.jsdelivr.net/npm/toastify-js/src/toastify.min.css";
document.getElementsByTagName("head")[0].appendChild(linkNode);
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "https://cdn.jsdelivr.net/npm/toastify-js";
script.onload = () => {
@ashwin-pc
ashwin-pc / TypingTool.js
Last active May 7, 2017 19:22
Typing tool
/**
* Typing tool Class:
* Class to simulate typing like actions
*
* @param {Object} options Options for the default settings of the class
* @param {Node} options.container the dom element to perform the typing on.
* @param {Number} options.speed the default speed of typing
* @param {Number} options.delay the default delay for typing
*
*/