Skip to content

Instantly share code, notes, and snippets.

@abigpotostew
abigpotostew / index.js
Last active November 16, 2021 18:39
Gradis to GIF script
/**
* Gradis Token to GIF
* Install:
* * npm i puppeteer gifencoder png-js
* Run:
* * node index.js 102402010402011602011606
* * node index.js 10360308020202100302110304,10350503030202000202140003,10160116030200020302040506
* tested on node v14.17.6
* For best results close all other apps and do not use your computer while this script loads.
* Make sure you have a couple GB of free memory and no other CPU intensive processes running.
<?
# MIT license, do whatever you want with it
#
# This is my invoice.php page which I use to make invoices that customers want,
# with their address on it and which are easily printable. I love Stripe but
# their invoices and receipts were too wild for my customers on Remote OK
#
require_once(__DIR__.'/../vendor/autoload.php');
@jasny
jasny / sha256-hmac.md
Last active December 12, 2023 12:32
Hashing examples in different languages

Example inputs:

Variable Value
key the shared secret key here
message the message to hash here

Reference outputs for example inputs above:

| Type | Hash |

@poindextrose
poindextrose / gcloud-signed-url.js
Last active December 4, 2020 00:32
Example on how to create a signed URL using Node.js for uploading a file to Google Cloud Storage
var gcloud = require('gcloud');
var uuid = require('uuid');
// Google Cloud Storage Bucket Name
const BUCKET_NAME = 'bucket-name';
// Google Developer Console project ID
const PROJECT_ID = 'project-1234';
/* Google Developer Console -> API Manager -> Credentials ->
Add credentials -> Service account -> JSON -> Create */
const KEY_FILENAME = 'project-0d3d97832ca7.json' // relative path
@PurpleBooth
PurpleBooth / README-Template.md
Last active May 6, 2024 07:22
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@hkhamm
hkhamm / installing_cassandra.md
Last active May 5, 2024 13:14
Installing Cassandra on Mac OS X

Installing Cassandra on Mac OS X

Install Homebrew

Homebrew is a great little package manager for OS X. If you haven't already, installing it is pretty easy:

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
@sheharyarn
sheharyarn / mongo_backup.sh
Last active January 23, 2024 16:54
Mongodump Shell Script for Cronjob
#!/bin/bash
MONGO_DATABASE="your_db_name"
APP_NAME="your_app_name"
MONGO_HOST="127.0.0.1"
MONGO_PORT="27017"
TIMESTAMP=`date +%F-%H%M`
MONGODUMP_PATH="/usr/bin/mongodump"
BACKUPS_DIR="/home/username/backups/$APP_NAME"
@andrei-m
andrei-m / levenshtein.js
Last active January 12, 2024 23:00
Levenshtein distance between two given strings implemented in JavaScript and usable as a Node.js module
/*
Copyright (c) 2011 Andrei Mackenzie
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
// Build the https based part & read the key and crt file that is required to encrypte the server / client connection
var ssl = https.createServer({
key: fs.readFileSync( "./ssl/ssl.private.key" ).toString()
, cert: fs.readFileSync( "./ssl/ssl.crt" ).toString()
});
// This is the part what it's all about, we are going to route all
// https based requires to the default app handler
ssl.addListener( "request", function sllRequestListener( req, res ){
req.ssl = true; // just add an extra flag so we can see if it was forwarded from https