Skip to content

Instantly share code, notes, and snippets.

@cookieplus
cookieplus / headless.js
Created October 16, 2023 11:51 — forked from 1chandu/headless.js
Min max blending with float render target
/* Node.js v10+ */
const puppeteer = require('puppeteer');
const URL = 'https://bl.ocks.org/1chandu/37743a37df149d0439cd91246884f92d';
puppeteer.launch({headless: true})
.then(async function(browser) {
const page = await browser.newPage();
page.on('console', event => {
@cookieplus
cookieplus / offset-path.js
Created May 14, 2022 16:55 — forked from mattdesl/offset-path.js
MIT – 2D vector path offsetting algorithm (work in progress)
/*
Copyright 2018 Matt DesLauriers
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
@cookieplus
cookieplus / install_seismic_unix.sh
Created May 5, 2022 08:33 — forked from botoseis/install_seismic_unix.sh
Seismic Unix installation script. Tested on Ubuntu 20.04.1 LTS
#!/bin/sh
# Check if the user has all necessary programs
if ! [ -x "$(command -v wget)" ]; then
printf "ERROR: wget must be installed. You can install it by running this command\n"
printf "\n$ sudo apt install -y wget\n\n"
exit 1
fi
# (WARNING) When setting the variables:
version: "3"
services:
mongo1:
hostname: mongo1
container_name: localmongo1
image: mongo:4.0-xenial
expose:
- 27017
ports:
- 27011:27017
@cookieplus
cookieplus / samplerest.js
Created January 14, 2021 05:08 — forked from joshbirk/samplerest.js
Sample of using passport w/ mult strategies
var fs = require("fs")
var ssl_options = {
key: fs.readFileSync('privatekey.pem'),
cert: fs.readFileSync('certificate.pem')
};
var port = process.env.PORT || 3000;
var express = require('express');
var ejs = require('ejs');
var passport = require('passport')
@cookieplus
cookieplus / app.js
Created January 14, 2021 05:08 — forked from saadtazi/app.js
passport multiple strategies
const express = require('express');
const cons = require('consolidate');
const bodyParser = require('body-parser');
const cookieParser = require('cookie-parser');
const session = require('express-session');
const passport = require('passport');
const FacebookStrategy = require('passport-facebook').Strategy;
const LocalStrategy = require('passport-local').Strategy;
const ensureLoggedIn = require('connect-ensure-login').ensureLoggedIn;
@cookieplus
cookieplus / 0dedict.py
Created November 23, 2020 05:33 — forked from josephg/0dedict.py
Apple dictionaries
# Thanks to commenters for providing the base of this much nicer implementation!
# Save and run with $ python 0dedict.py
# You may need to hunt down the dictionary files yourself and change the awful path string below.
# This works for me on MacOS 10.14 Mohave
from struct import unpack
from zlib import decompress
import re
filename = '/System/Library/Assets/com_apple_MobileAsset_DictionaryServices_dictionaryOSX/9f5862030e8f00af171924ebbc23ebfd6e91af78.asset/AssetData/Oxford Dictionary of English.dictionary/Contents/Resources/Body.data'
f = open(filename, 'rb')