Skip to content

Instantly share code, notes, and snippets.

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

Krister Andersson Cyclonecode

🏠
Working from home
View GitHub Profile
@cyberwani
cyberwani / wordpress-upload-base64.php
Created September 13, 2019 10:19
Upload a base64 string as image to the WordPress media library
<?php
/**
* Save the image on the server.
*/
function save_image( $base64_img, $title ) {
// Upload dir.
$upload_dir = wp_upload_dir();
$upload_path = str_replace( '/', DIRECTORY_SEPARATOR, $upload_dir['path'] ) . DIRECTORY_SEPARATOR;
@mohanpedala
mohanpedala / bash_strict_mode.md
Last active April 22, 2026 23:54
set -e, -u, -o, -x pipefail explanation
@daggerhart
daggerhart / _genCert.sh
Last active September 18, 2019 10:43
Simple script to generate a certificate used for local development on OSX
#!/bin/bash
read -p 'Domain: ' DOMAIN
openssl req \
-newkey rsa:2048 \
-x509 \
-nodes \
-keyout "$DOMAIN".key \
-new \
@ianmjones
ianmjones / build-as3cf-aws2.sh
Last active March 21, 2025 19:21
A script for downloading the AWS PHP SDK v2, stripping down to S3 functionality and then applying a custom namespace.
#!/usr/bin/env bash
set -e
if [ ! -d src/amazon-s3-and-cloudfront ]; then
echo 'This script must be run from the repository root.'
exit 1
fi
for PROG in composer find sed