Skip to content

Instantly share code, notes, and snippets.

View Raidus's full-sized avatar

Wilhelm R. Raidus

View GitHub Profile
@Raidus
Raidus / getdates.js
Created June 29, 2018 13:13 — forked from miguelmota/getDates.js
Get dates in between two dates with JavaScript.
// Returns an array of dates between the two dates
var getDates = function(startDate, endDate) {
var dates = [],
currentDate = startDate,
addDays = function(days) {
var date = new Date(this.valueOf());
date.setDate(date.getDate() + days);
return date;
};
while (currentDate <= endDate) {
const puppeteer = require('puppeteer');
const ProxyChain = require('proxy-chain');
const ROUTER_PROXY = 'http://127.0.0.1:8000';
const uas = [
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36',
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36',
];
// To do: Get more agents from: https://developers.whatismybrowser.com/useragents/explore/software_name/chrome/1
const UAs = [
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36',
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36',
'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36',
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36',
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/603.2.4 (KHTML, like Gecko) Version/10.1.1 Safari/603.2.4',
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36',
'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36',
const request = require('request-promise');
const puppeteer = require('puppeteer');
const fs = require('fs');
const Sock5HttpAgent = require('socks5-http-client/lib/Agent');
const Sock5HttpsAgent = require('socks5-https-client/lib/Agent');
const logDir = 'tmp';
if (!fs.existsSync(logDir)) {
fs.mkdirSync(logDir);
// Reference: https://blog.apify.com/how-to-make-headless-chrome-and-puppeteer-use-a-proxy-server-with-authentication-249a21a79212
const puppeteer = require('puppeteer');
const proxyChain = require('proxy-chain');
const { PROXYMESH_USER, PROXYMESH_PASSWORD } = require('../config/keys');
(async () => {
const oldProxyUrl = `http://${PROXYMESH_USER}:${PROXYMESH_PASSWORD}@de.proxymesh.com:31280`;
const newProxyUrl = await proxyChain.anonymizeProxy(oldProxyUrl);
@Raidus
Raidus / README.md
Created May 3, 2018 18:08 — forked from meyerdan/README.md
Human consumable text format for simple workflows

Motivation

Allow developers to specify workflows without the need for installing additional tooling such as a modeler.

Goals

  • It should be easy to define a simple workflow with a text editor only
  • The format must map down directly to BPMN
  • The format must be based on an existing text based format like (XML, JSON, YAML, TOML, ...)
sudo apt-get update && sudo apt-get install -yq libgconf-2-4
sudo apt-get update && sudo apt-get install -y wget --no-install-recommends \
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
&& apt-get update \
&& apt-get install -y google-chrome-unstable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst ttf-freefont \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get purge --auto-remove -y curl \
&& rm -rf /src/*.deb
@Raidus
Raidus / check_cpu_credits.sh
Created January 7, 2018 18:31 — forked from daniilyar-confyrm/check_cpu_credits.sh
[Nagios-check] AWS EC2 - check how much CPU credits are left at the instance
#!/bin/bash
set -e
OK=0
WARN=1
CRIT=2
UNKNOWN=3
function get_warning_limit {
@Raidus
Raidus / Node_AWS_Linux.md
Created November 25, 2017 22:25 — forked from nrollr/Node_AWS_Linux.md
Install Node.js on Amazon Linux (EC2)

Installing Node.js on Amazon Linux AMI

The following will guide you through the process of installing Node.js on an AWS EC2 instance running Amazon Linux AMI 2016.09 - Release Notes

For this process I'll be using a t2.micro EC2 instance running Amazon Linux AMI (ami-d41d58a7). Once the EC2 instance is up-and-running, connect to your server via ssh

@Raidus
Raidus / schema-generator.js
Created November 15, 2017 14:38 — forked from oyvindholmstad/schema-generator.js
BigQuery JSON schema generator in Javascript and Scala
/*
A script to generate a Google BigQuery-complient JSON-schema from a JSON object.
Make sure the JSON object is complete before generating, null values will be skipped.
References:
https://cloud.google.com/bigquery/docs/data
https://cloud.google.com/bigquery/docs/personsDataSchema.json
https://gist.github.com/igrigorik/83334277835625916cd6
... and a couple of visits to StackOverflow