Skip to content

Instantly share code, notes, and snippets.

View anku255's full-sized avatar
🎯
Focusing

Ankit Tiwari anku255

🎯
Focusing
View GitHub Profile
@anku255
anku255 / launchdarkly_percentage_rollout.ts
Created June 14, 2023 12:01
Launchdarkly's percentage rollout algorithm
import * as crypto from 'node:crypto';
interface WeightedVariation {
variationIndex: number;
weight: number;
}
interface Context {
key: string;
[attribute: string]: any;
@anku255
anku255 / manageGHLabels.js
Created April 8, 2021 05:53
Node script to manage GitHub labels
const fetch = require('isomorphic-fetch');
const PERSONAL_ACCESS_TOKEN = '';
const repos = [
"yc-frontend",
"yc-gateway",
"yc-biz-logic",
"yc-database",
@anku255
anku255 / updateRemoteUrl.js
Created March 16, 2021 07:58
Update remote url in all repos inside a directory
const fs = require('fs');
const { exec } = require("child_process");
function getDirectories(path) {
return fs.readdirSync(path).filter(function (file) {
return fs.statSync(path+'/'+file).isDirectory();
});
}
@anku255
anku255 / package.json
Created March 14, 2020 06:23
IvyPods eslint package.json
{
"scripts": {
"lint:fs:js": "eslint --fix --ext .js ./frontend-service/components ./frontend-service/hocs ./frontend-service/lib ./frontend-service/pages ./frontend-service/reusable-components ./frontend-service/utils",
"lint:gql": "eslint ./gql-service/src ./gql-service/scripts ./gql-service/index.js",
"lint:api": "eslint ./api-service/src ./api-service/scripts ./api-service/index.js",
"lint:db": "eslint ./db-service/src ./db-service/scripts ./db-service/index.js"
},
"devDependencies": {
"babel-eslint": "^10.1.0",
"eslint": "^6.8.0",
@anku255
anku255 / .eslintrc
Created March 14, 2020 05:25
IvyPods eslint config
{
"extends": [
"airbnb",
"plugin:prettier/recommended"
],
"parser": "babel-eslint",
"settings": {
"react": {
"version": "16.3"
}
@anku255
anku255 / DCEL.py
Created September 5, 2019 21:24
Double Connected Edge List (DCEL) implmented in python
import math as m
# Utils
def findHAngle(dx, dy):
"""Determines the angle with respect to the x axis of a segment
of coordinates dx and dy
"""
l = m.sqrt(dx*dx + dy*dy)
if dy > 0:
return m.acos(dx/l)
@anku255
anku255 / noTryCatch.js
Created April 22, 2019 13:25
Error handler wrapper for Async Await
/* Helper buddy for removing async/await try/catch litter 🗑 */
function O_o(promise) {
return promise.then(data => {
if (data instanceof Error) return [data]
return [null, data]
}).catch(err => [err])
}
/* Look ma, no try/catch */
async function usageExample(params) {
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<link
rel="stylesheet"
href="https://unpkg.com/leaflet@1.4.0/dist/leaflet.css"
integrity="sha512-puBpdR0798OZvTTbP4A8Ix/l+A4dHDD0DGqYW6RQ+9jxkRFclaxxQb/SJAWZfWAkuyeQUytO7+7N4QKrDh+drA=="
@anku255
anku255 / ssh.md
Created January 31, 2019 04:34 — forked from bradtraversy/ssh.md
SSH & DevOps Crash Course Snippets

SSH Cheat Sheet

This sheet goes along with this SSH YouTube tutorial

Login via SSH with password (LOCAL SERVER)

$ ssh brad@192.168.1.29

Create folder, file, install Apache (Just messing around)

$ mkdir test

$ cd test