Skip to content

Instantly share code, notes, and snippets.

View Tam's full-sized avatar
🐢
I may be slow to respond.

Tam Tam

🐢
I may be slow to respond.
View GitHub Profile
@Tam
Tam / Usage.md
Last active October 30, 2021 20:02
Convert .m4a files that don't work with Spotify to ones that do

How to use (macOS)

  1. $ brew install ffmpeg --with-fdk-aac --with-tools --with-freetype --with-libass --with-libvorbis --with-libvpx --with-x265
    a. You probably will only need the --with-fdk-aac flag, but I'm not sure.
  2. $ cd into the directory with the files you want to fix.
  3. Place the fix_m4a file into that directory (remove the .sh file extension)
  4. $ chmod 700 fix_m4a to allow you to run it
  5. $ ./fix_m4a This will fix all the .m4a files, creating fixed versions prefixed with s-.
<?php
// Stripped down for brevity
class BPlugin {
public function init () {
// Trigger Google Shopping updates
// =====================================================================
if (!craft()->config->get('devMode')) {
@Tam
Tam / db.sh
Created June 25, 2018 09:34
Postgres DB remote to local puller
#!/bin/bash
ssh devski "pg_dump -U postgres -h 127.0.0.1 -w [DB_NAME] | gzip" >> "/Users/[USER_FOLDER]/Downloads/db.sql.gz";
"/Applications/Postgres.app/Contents/Versions/10/bin/dropdb" [DB_NAME];
"/Applications/Postgres.app/Contents/Versions/10/bin/createdb" [DB_NAME];
gunzip -c "/Users/[USER_FOLDER]/Downloads/db.sql.gz" | "/Applications/Postgres.app/Contents/Versions/10/bin/psql" [DB_NAME] -U postgres;
rm "/Users/[USER_FOLDER]/Downloads/db.sql.gz";
@Tam
Tam / crontab
Last active February 23, 2019 10:45
Digital Ocean IP A record updater
*/15 * * * * python /path/to/ddns.py
@Tam
Tam / command.sh
Last active May 16, 2019 10:17
Craft CMS Ngrok w/ Docker
ngrok http dev.example.com:443 -host-header=dev.example.com -region=eu
@Tam
Tam / cmd.sh
Last active June 25, 2019 10:30
Using ngrok with Craft CMS 3
ngrok http -region=eu -host-header=my-dev-domain.local 443
@Tam
Tam / currency-to-country.csv
Last active October 15, 2020 10:49
Mapping country code to currency code with currency name and symbol
country country_code currency unit_text symbol
New Zealand NZ NZD New Zealand Dollar $
Cook Islands CK NZD New Zealand Dollar $
Niue NU NZD New Zealand Dollar $
Pitcairn PN NZD New Zealand Dollar $
Tokelau TK NZD New Zealand Dollar $
Australian AU AUD Australian Dollar $
Christmas Island CX AUD Australian Dollar $
Cocos (Keeling) Islands CC AUD Australian Dollar $
Heard and Mc Donald Islands HM AUD Australian Dollar $
@Tam
Tam / preact-router-match-hook.js
Last active December 10, 2020 15:47
Preact Router match hook (useMatch)
import { getCurrentUrl, exec, subscribers } from 'preact-router';
import { useEffect, useState } from 'preact/hooks';
/**
* Hook to check if the given path matches the current URL
*
* const [matches, { path }] = useMatch('/my/:path?');
*
* @param {string} path - The path to check against
* @return {[boolean, Object]}
@Tam
Tam / Plugin.php
Last active September 23, 2022 04:07
Add subscription pause support to Commerce Stripe
<?php
namespace modules;
use Craft;
use craft\commerce\elements\Subscription;
use DateTime;
use Twig\Error\LoaderError;
use Twig\Error\SyntaxError;
use yii\base\Module;
@Tam
Tam / regex.txt
Created January 28, 2021 10:01
Regex to remove comments from graphql.schema file
/\s+"""[\s\S]*?"""/sg