Enjoy ! 😄
Download iTerm2 here.
// Cancel all the Stripe subscriptions supplied from a CSV export | |
const fs = require('fs') | |
const neatCsv = require('neat-csv') | |
const moment = require('moment') | |
const stripe = require('stripe')('sk_live_xxx') | |
// subscriptions.csv is the full export of subs from the stripe billing dashboard | |
fs.readFile('./subscriptions.csv', async (err, data) => { | |
if (err) return console.error(err) |
Enjoy ! 😄
Download iTerm2 here.
#!/usr/bin/env bash | |
# supervisor-log-compress.sh | |
# | |
# supervisord writes logs, and rotates them, but does not compress old log | |
# files. This script is meant to help with that cleanup, reclaiming storage. | |
# | |
# A nice place for this script is in: /etc/cron.daily/ | |
for f in /var/log/supervisor/*.log.*; do |
Laravel 10+, Horizon 5.x, Redis/Valkey 7+
Prepare application
http://yourapp.com/horizon
inactive
on horizon dashboardInstall redis-server
#!/bin/python | |
# | |
# Copyright 2016 Flavio Garcia | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# |
import requests | |
def get_status_code(url): | |
try: | |
r = requests.get(url) | |
print "Processing " + url | |
if len(r.history) > 0: | |
chain = "" | |
code = r.history[0].status_code |
""" | |
Author: Eric J. Ma | |
Purpose: To merge PDFs together in an automated fashion. | |
""" | |
import os | |
from PyPDF2 import PdfFileReader, PdfFileMerger |
"""Asynchronous requests in Flask with gevent""" | |
from time import time | |
from flask import Flask, Response | |
from gevent.pywsgi import WSGIServer | |
from gevent import monkey | |
import requests |
DynamoDB is a powerful, fully managed, low latency, NoSQL database service provided by Amazon. DynamoDB allows you to pay for dedicated throughput, with predictable performance for "any level of request traffic". Scalability is handled for you, and data is replicated across multiple availability zones automatically. Amazon handles all of the pain points associated with managing a distributed datastore for you, including replication, load balancing, provisioning, and backups. All that is left is for you to take your data, and its access patterns, and make it work in the denormalized world of NoSQL.
The single most important part of using DynamoDB begins before you ever put data into it: designing the table(s) and keys. Keys (Amazon calls them primary keys) can be composed of one attribute, called a hash key, or a compound key called the hash and range key. The key is used to uniquely identify an item in a table. The choice of the primary key is particularl