Skip to content

Instantly share code, notes, and snippets.

View singhrajkr's full-sized avatar
🇮🇳
Indian

Raj Kumar singhrajkr

🇮🇳
Indian
View GitHub Profile
def flatten_json(nested_json):
"""
Flatten json object with nested keys into a single level.
Args:
nested_json: A nested json object.
Returns:
The flattened json object if successful, None otherwise.
"""

Self-Signed cert

Linux

  1. Copy or SFTP certificate to machine
  2. Go to /usr/local/share/ca-certificates/
  3. Create a new folder, i.e. "sudo mkdir my-cert"
  4. Copy the .crt file into the my-cert folder
  5. Make sure the permissions are OK (755 for the folder, 644 for the file)
  6. Run sudo update-ca-certificates
@singhrajkr
singhrajkr / recaptcha-v3-solver.py
Created August 16, 2020 20:05 — forked from oursocks/recaptcha-v3-solver.py
How to solve reCAPTCHA v3 using Python for Scraping the Easy Way (Using an OCR API)
import imagetyperzapi2
#... then go to the page using a webdriver object called driver
try:
driver.find_element_by_xpath("//*[@data-sitekey]")
captcha = True
except NoSuchElementException:
captcha = False
worker_processes 5; ## Default: 1
error_log logs/error.log;
pid logs/nginx.pid;
worker_rlimit_nofile 8192;
events {
worker_connections 4096; ## Default: 1024
}
http {
@singhrajkr
singhrajkr / footgun.md
Created February 14, 2020 19:01 — forked from Rich-Harris/footgun.md
Top-level `await` is a footgun

Edit — February 2019

This gist had a far larger impact than I imagined it would, and apparently people are still finding it, so a quick update:

  • TC39 is currently moving forward with a slightly different version of TLA, referred to as 'variant B', in which a module with TLA doesn't block sibling execution. This vastly reduces the danger of parallelizable work happening in serial and thereby delaying startup, which was the concern that motivated me to write this gist
  • In the wild, we're seeing (async main(){...}()) as a substitute for TLA. This completely eliminates the blocking problem (yay!) but it's less powerful, and harder to statically analyse (boo). In other words the lack of TLA is causing real problems
  • Therefore, a version of TLA that solves the original issue is a valuable addition to the language, and I'm in full support of the current proposal, which you can read here.

I'll leave the rest of this document unedited, for archaeological

@singhrajkr
singhrajkr / staircase.js
Created September 1, 2019 20:06
Print a staircase of size n using '#' and ' ' characters. #hackerrank #warmup
/*
Solution for HackerRank > Algorithms > Warmup > Staircase
https://www.hackerrank.com/challenges/staircase
*/
function main() {
var n = 6;
var space, hash, stair;
for (var i = 0; i < n; i++){
import { browser, by, protractor, element, promise, ElementFinder, ElementArrayFinder } from 'protractor';
describe('Test', () => {
var originalTimeout;
beforeEach(() => {
originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 120000;
browser.driver.sleep(3000);
});
const { SpecReporter } = require('jasmine-spec-reporter')
exports.config = {
allScriptsTimeout: 110000,
getPageTimeout: 110000,
specs: [
'./e2e/**/example.e2e-spec.ts',
],
capabilities: {
browserName: 'chrome'
require("dotenv").config();
const fetch = require("node-fetch");
var Guid = require("guid");
var sha256 = require("sha256");
var jwt = require("jsonwebtoken");
var app = require("express")(),
port = process.env.PORT || 8040,
// Skype Interview Payload