Skip to content

Instantly share code, notes, and snippets.

from typing import List
import requests
API_ROOT = 'http://localhost:8000/api/v1' # This is the default for Airbyte
def get_workspaces() -> List[str]:
response = requests.post(f'{API_ROOT}/workspaces/list')
response.raise_for_status() # Either handle this yourself, or use a tool like Sentry for logging
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',
@datawithdev
datawithdev / nginx.conf
Created June 1, 2019 17:19 — forked from mjurincic/nginx.conf
Setup NodeJS Production with PM2, Nginx on AWS Ubuntu 16.04 server
proxy_http_version 1.1;
proxy_set_header Connection "";
https://gist.github.com/miguelmota/6912559
# The upstream module is the link between Node.js and Nginx.
# Upstream is used for proxying requests to other servers.
# All requests for / get distributed between any of the servers listed.
upstream helloworld {
# Set up multiple Node.js webservers for load balancing.
# max_fails refers to number of failed attempts
# before server is considered inactive.
@datawithdev
datawithdev / Envoy.blade.php
Created October 5, 2018 18:36 — forked from michaeldyrynda/Envoy.blade.php
Laravel 5 Envoy deploy configuration
@servers([ 'remote' => 'server.example.com', ])
@setup
if ( ! isset($repo) )
{
throw new Exception('--repo must be specified');
}
if ( ! isset($base_dir) )
{
#!/usr/bin/env bash
# Bash script to back up an easyengine webiste installation
# To debug, use set -xe
# I personally prefer to create an alias, after I placed this file at ~/scripts/
# echo 'alias eebackup=". ~/scripts/eebackup.sh"' >> ~/.bash_aliases
# . ~/.bash_rc to load the new alias
# Note that the script will also create a log at the /var/www/backupdomain.com/logs/ folder
set -e
LOG_FILE="/var/www/$1/logs/eebackup.log"
# Gist example of IB wrapper ...
#
# Download API from http://interactivebrokers.github.io/#
#
# Install python API code /IBJts/source/pythonclient $ python3 setup.py install
#
# Note: The test cases, and the documentation refer to a python package called IBApi,
# but the actual package is called ibapi. Go figure.
#
# Get the latest version of the gateway:
@datawithdev
datawithdev / www-post-thumb.php
Created March 4, 2016 19:16 — forked from gmazzap/www-post-thumb.php
WordPress plugin that allow to use an external image url as featured image.
<?php namespace GM\WWWPostThumbnail;
/**
* Plugin Name: WWW Post Thumbnail
* Description: Allow to use an external image url as featured image.
* Plugin URI: https://gist.github.com/Giuseppe-Mazzapica/928bc22e5f49a654cf7c
* Author: Giuseppe Mazzapica
* Author URI: https://github.com/Giuseppe-Mazzapica
* License: MIT
* Version: 0.1.0
*
@datawithdev
datawithdev / geb-script.groovy
Created October 18, 2015 15:48 — forked from crazy4groovy/geb-script.groovy
A gentle intro script for the Geb setup you'll need to do basic web testing/scraping. (browse, navigate, click, download, screenshot)
//updated Jan 12 2013
//check out Geb/Phantomjs integration via RemoteWebDriver support!
@Grapes([
@Grab("junit:junit-dep:4.8.2"),
@Grab("org.codehaus.geb:geb-junit4:0.7.2"), //soon to go 0.9.0
@Grab("org.seleniumhq.selenium:selenium-firefox-driver:2.28.0"),
@Grab("org.seleniumhq.selenium:selenium-remote-driver:2.28.0"),
@Grab("org.seleniumhq.selenium:selenium-support:2.28.0")
])
@datawithdev
datawithdev / session
Created March 30, 2012 23:34 — forked from dberry37388/session
Simple FuelPHP task to create/drop the sessions DB table
<?
/**
* Sessions DB Table Task
*
* Run this task to set add/remove/clear the db sessions table
* for your app. This could be expanded in app/tasks for application specific stuff.
*
* @version 1.0
* @author Daniel Berry
* @license MIT License