Skip to content

Instantly share code, notes, and snippets.

View enVolt's full-sized avatar

Ashwani Agarwal enVolt

View GitHub Profile
find_slot = function () {
acc = document.getElementById("appointment_accordion")
acc.childElements().forEach(el => {
slots_parent = el.childElements()[1].childElements()[0].childElements()[0]
slots_parent.childElements().forEach(day_slot => {
date = day_slot.getElementsByClassName("appt-table-d")[0].innerHTML.replace("<br>", ",")
slots = day_slot.getElementsByTagName("a");
for (i = 0; i < slots.length; i++) {
slot = slots[i];
index = slot.getAttribute("class").indexOf("full")
@enVolt
enVolt / README.md
Created August 30, 2019 05:56
Create GitLab Merge Request from CLI

Create GitLab Merge Request from CLI

Since GitLab didn't have any CLI tool similar to GitHub (hub), I find it a very cumbersome task to raise a GitLab Merge Request to develop branch. Though GitLab automatically returns a URL which can be used to create a Merge Request, by default it proceed with master branch (or whatever is your default branch)

I created this small python script, which uses the GitLab APIs to generate a Merge Request, where the Target Branch for Merge Request can be passed as an argument.

Origin is extracted from the Git remote URL. This works fine if you're using SSH based URL, else modify the logic on Line #9.

Title is the last commit message

@enVolt
enVolt / README.md
Last active August 23, 2019 08:51
Lambda Function to change CPU Credits to Unlimited

This simple Lambda JS code can be used to update CPU Credits to 'unlimited' for a newly launched instances.

We had configured Auto-scaling. Due to budget constraint all the instances were on most basic spec possible (t2.micro or t2.nano) To avoid outage, we had enabeld T2 Unlimited on all. Since, autoscaling creates new instance, this may lead to outage.

Under CloudWatch events, create an event source with following configuration -

{
 "source": [
@enVolt
enVolt / pre-commit
Last active February 9, 2017 13:50
Pre-commit hook for Node.js Project
#! /bin/sh
npm run eslint
RESULT=$?
echo $RESULT
[ $RESULT -ne 0 ] && exit 1
npm test
RESULT=$?
[ $RESULT -ne 0 ] && exit 1
@enVolt
enVolt / .eslint.json
Last active July 23, 2016 16:37
ESLint Config file
{
"parserOptions": {
"ecmaVersion": 6,
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
"jsx": true
},
"sourceType": "module"
},