Skip to content

Instantly share code, notes, and snippets.

@vincelwt
vincelwt / cancelAll.js
Created April 15, 2020 14:48
Scripts to migrate all subscriptions between two Stripe accounts
// 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)
@PierreThiollent
PierreThiollent / Readme.md
Last active February 6, 2025 10:24
iTerm2 and Oh-my-zsh config

Setup iTerm2 and oh-my-zsh

Enjoy ! 😄

Install iTerm 2

Download iTerm2 here.

Cheatsheet for Django QuerySets

Current Django Version: 2.2

Methods that return new QuerySets

Can be chained:

Entry.objects.filter(**kwargs).exclude(**kwargs).order_by(**kwargs)
@roens
roens / supervisor-log-compress.sh
Last active March 1, 2021 07:49
Since `supervisord` [lacks an option for compression of rotated log files](https://github.com/Supervisor/supervisor/issues/322), I wrote this script. It works well to live in `/etc/cron.daily`.
#!/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
@ankurk91
ankurk91 / laravel_horizon.md
Last active January 23, 2025 05:08
Laravel Horizon, redis/valkey-server, supervisord on Ubuntu server

Laravel Horizon, redis-server, supervisord on Ubuntu 20/22/24 server

Laravel 10+, Horizon 5.x, Redis/Valkey 7+

Prepare application

  • Install and configure Laravel Horizon as instructed in docs
  • Make sure you can access the Horizon dashboard like - http://yourapp.com/horizon
  • For now; it should show status as inactive on horizon dashboard

Install redis-server

@lmcneel
lmcneel / remove-node-modules.md
Last active April 18, 2025 19:05
How to remove node_modules after they have been added to a repo

How to remove node_modules

Create a .gitignore file

  1. Check for an existing .gitignore file in the project directory
ls -a
@piraz
piraz / monitor_service.py
Last active April 6, 2022 02:58
Script that monitors a service running on systemd. If service is not running the script will try to start the service.
#!/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
#
@ntanya
ntanya / gist:816cba067f0e0dccc524
Last active April 27, 2021 05:35
Python script to check HTTP status and redirect chains
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
@ericmjl
ericmjl / merger.py
Created June 5, 2015 16:50
A Python script for merging PDF files together.
"""
Author: Eric J. Ma
Purpose: To merge PDFs together in an automated fashion.
"""
import os
from PyPDF2 import PdfFileReader, PdfFileMerger
@sergray
sergray / async_flask.py
Last active January 27, 2025 21:33
Asynchronous requests in Flask with gevent
"""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