Skip to content

Instantly share code, notes, and snippets.

View fideloper's full-sized avatar
🏠
Working from home

Chris Fidao fideloper

🏠
Working from home
View GitHub Profile
<?
//
// AUTO KEYWORD-BASED FOLLOWER CURATION BOT (by @levelsio)
//
// File: twitterFollowerCuratorBot.php
//
// Created: May 2021
// License: MIT
//
@matthiasr
matthiasr / delete-s3.sh
Created December 14, 2020 09:18
Delete everything in an S3 bucket (in a hurry)
# I needed to delete ~300k objects from an S3 bucket in a hurry. The better and cheaper solution is to use a lifecycle rule, but those can take a day or two to take effect.
bucket="i-want-to-lose-all-my-data"
mkdir -p deletes
# 1. List all the objects in the bucket, transform them 1000 at a time into request objects for DeleteObjects, write each to a separate file
aws s3api list-objects-v2 --bucket "${bucket}" \
| jq -c '.Contents | _nwise(1000) | map({ Key: .Key }) | { Objects: ., Quiet: true }' \
| awk '{ f = "deletes/" NR ".json"; print $0 > f; close(f) }'
@kostaz
kostaz / install-ripgrep-on-ubuntu.sh
Created September 21, 2018 20:33
Install ripgrep on Ubuntu
#!/bin/bash
[[ $UID == 0 ]] || { echo "run as sudo to install"; exit 1; }
REPO="https://github.com/BurntSushi/ripgrep/releases/download/"
RG_LATEST=$(curl -sSL "https://api.github.com/repos/BurntSushi/ripgrep/releases/latest" | jq --raw-output .tag_name)
RELEASE="${RG_LATEST}/ripgrep-${RG_LATEST}-x86_64-unknown-linux-musl.tar.gz"
TMPDIR=$(mktemp -d)
cd $TMPDIR
wget -O - ${REPO}${RELEASE} | tar zxf - --strip-component=1
@steven2358
steven2358 / ffmpeg.md
Last active April 16, 2024 16:46
FFmpeg cheat sheet
@NoodlesNZ
NoodlesNZ / Jenkinsfile
Created April 11, 2017 23:08
PHP Pipeline
pipeline {
agent any
stages {
stage('Checkout') {
steps {
checkout scm
sh 'rm -rf build/{logs,pdepend}'
@mpstenson
mpstenson / Resize_Column_Based_On_Content.sql
Created August 31, 2016 15:52
Resize Column Based On Content (for mysql
SET @column_name = 'Custom2';
select @column_name;
SET @width_query = CONCAT('SET @max_width = (SELECT CHAR_LENGTH(' , @column_name , ') AS mlen FROM `HS_Request` ORDER BY mlen DESC LIMIT 1)+10;');
PREPARE stmt FROM @width_query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @query = CONCAT('ALTER TABLE HS_Request MODIFY ', @column_name, ' VARCHAR(', @max_width, ');');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
for bucket in $(aws s3api list-buckets --query 'Buckets[*].{Name:Name}' --output text)
do
echo "$bucket:"
region=$(aws s3api get-bucket-location --bucket $bucket --query 'LocationConstraint' --output text | awk '{sub(/None/,"eu-west-1")}; 1')
parts=$(aws s3api list-multipart-uploads --bucket $bucket --region $region --query 'Uploads[*].{Key:Key,UploadId:UploadId}' --output text)
if [ "$parts" != "None" ]; then
IFS=$'\n'
@sandcastle
sandcastle / aurora_cluster.tf
Created March 25, 2016 09:44
Creates a AWS RDS Aurora Cluster with Terraform
########################
## Variables
########################
variable "environment_name" {
description = "The name of the environment"
}
variable "vpc_id" {
@alexbilbie
alexbilbie / Caddyfile
Created January 7, 2016 15:29
PHP-FPM Caddyfile example
root /app/public
tls /app/_docker/caddy/server.crt /app/_docker/caddy/server.key
fastcgi / php:9000 php
errors visible
rewrite {
regexp .*
ext /
to /index.php?{query}
}
server {
listen 80;
listen [::]:80;
server_name site.com;
root /home/forge/site.com;
# FORGE SSL (DO NOT REMOVE!)
# ssl on;
# ssl_certificate;
# ssl_certificate_key;