Skip to content

Instantly share code, notes, and snippets.

async function scrollDown() {
const wrapper = document.querySelector("#search-page-list-container");
await new Promise((resolve, reject) => {
var totalHeight = 0;
var distance = 600;
var timer = setInterval(async () => {
var scrollHeightBefore = wrapper.scrollHeight;
wrapper.scrollBy(0, distance);
totalHeight += distance;
const puppeteer = require('puppeteer');
class Webpage {
static async generatePDF(url) {
const browser = await puppeteer.launch({ headless: true }); // Puppeteer can only generate pdf in headless mode.
const page = await browser.newPage();
await page.goto(url, { waitUntil: 'networkidle', networkIdleTimeout: 5000 }); // Adjust network idle as required.
const pdfConfig = {
path: 'url.pdf', // Saves pdf to disk.
format: 'A4',
@SantoshSrinivas79
SantoshSrinivas79 / n8n-deployment.yml
Created October 2, 2021 06:16 — forked from bacarini/n8n-deployment.yml
N8N - Kubernetes complete configuration
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: n8n-deployment
namespace: standard
labels: &labels
app: n8n
component: deployment
spec:
@SantoshSrinivas79
SantoshSrinivas79 / gist:f6f68bc11f5a5d1956af5a99fd639c40
Created September 20, 2020 15:45 — forked from kitek/gist:1579117
NodeJS create md5 hash from string
var data = "do shash'owania";
var crypto = require('crypto');
crypto.createHash('md5').update(data).digest("hex");
@SantoshSrinivas79
SantoshSrinivas79 / daily coding post to demonstrate using ggtext.R
Last active February 21, 2020 06:08
daily coding post to demonstrate using ggtext
# daily coding post to demonstrate using ggtext
# credit: late night watch of [Spruce up your ggplot2 visualizations with formatted text? - Claus Wilke](https://resources.rstudio.com/rstudio-conf-2020/spruce-up-your-ggplot2-visualizations-with-formatted-text-claus-wilke)
# Inspired by:
# https://gist.github.com/gkaramanis/a18438d624e495784af38932650c6abe
# https://twitter.com/geokaramanis/status/1230549592103456769?s=20
# remotes::install_github("wilkelab/ggtext")
library(ggplot2)
ggplot(data = data.frame(x = c(-4, 6)), aes(x)) +
stat_function(fun = dnorm, n = 101, args = list(mean = 0, sd = 1), geom = "area", fill = "#F5BB87", alpha = 0.9) +
stat_function(fun = dnorm, n = 101, args = list(mean = 2.7, sd = 1), geom = "area", fill = "#BBD4EB", alpha = 0.9) +
coord_fixed(xlim = c(-5, 7), ratio = 8, clip = "off") +
annotate("segment", x = -3.9, y = 0, xend = 6, yend = 0, color = "grey60", size = 1.3) +
annotate("segment", x = -3.5, y = -0.04, xend = -3.5, yend = 0.42, color = "grey60", size = 1.3) +
annotate("text", x = 0, y = 0.18, label = "what people\nactually do\nin R", family = "Arial Bold", color = "white", size = 5.2) +
annotate("text", x = 2.75, y = 0.18, label = "what people\nassume others\ndo in R", family = "Arial Bold", color = "white", size = 5.2) +
@SantoshSrinivas79
SantoshSrinivas79 / Ghost - Box Spread Analysis on NSE.md
Last active February 16, 2019 06:55
Ghost - Box Spread Analysis on NSE
@SantoshSrinivas79
SantoshSrinivas79 / Ghost install notes.md
Created February 9, 2019 09:16
Ghost install notes
@SantoshSrinivas79
SantoshSrinivas79 / Create scaffolder for a meteor collection.md
Last active February 7, 2019 10:35
Create scaffolder for a meteor collection

Meteor Scaffolder

  • Get list of files required
find . -type f -name '*ghost*.js'
rm -rf ~/temp/scaffolder
mkdir -p ~/temp/scaffolder
dualplot <- function(x1, y1, y2, x2 = x1,
col = c("#C54E6D", "#009380"),
lwd = c(1, 1), colgrid = NULL,
mar = c(3, 6, 3, 6) + 0.1,
ylab1 = paste(substitute(y1), collapse = ""),
ylab2 = paste(substitute(y2), collapse = ""),
nxbreaks = 5,
yleg1 = paste(gsub("\n$", "", ylab1), "(left axis)"),
yleg2 = paste(ylab2, "(right axis)"),
ylim1 = NULL, ylim2 = NULL, ylim.ref = NULL,