This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as _ from 'lodash' | |
import * as objectPath from 'object-path' | |
import * as stringify from 'json-stringify-safe' | |
/** | |
* Recursively replace undefined with null. | |
*/ | |
export function undefinedToNull<T>(obj: T): T { | |
if (obj === undefined) { | |
return null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -XGET 'http://makersearch.prod.lovecrafts.cool:9200/read-model/_search' -d ' | |
{ | |
"query": { | |
"filtered": { | |
"filter": { | |
"and": [ | |
{ | |
"bool": { | |
"must": { | |
"term": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import division | |
import argparse | |
from PIL import Image | |
from math import log | |
parser = argparse.ArgumentParser() | |
parser.add_argument("start_file", help="filename of initial image") | |
parser.add_argument( | |
"-x", | |
"--xpercent", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
mplayer http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio4fm_mf_p |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INSERT INTO catalog_product_entity_varchar | |
(entity_type_id, attribute_id, store_id, entity_id, `value`) | |
SELECT | |
4 AS entity_type_id, | |
216 AS attribute_id, | |
`existing_value`.store_id, | |
`existing_option_id`.entity_id, | |
`existing_value`.`value` | |
FROM `eav_attribute_option_value` AS `existing_value` | |
INNER JOIN catalog_product_entity_int AS `existing_option_id` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Throwaway Gulp script to insert dates from file-names into the front-matter | |
// of content source files | |
var gulp = require('gulp'), | |
through = require('through2'); | |
gulp.task('insert-dates', function() { | |
return gulp.src('content/posts/**/*.md') | |
.pipe(through.obj( | |
function(file, enc, callback) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is a throwaway / single-use gulpfile I used to process and tidy up the | |
// files resulting from using Jekyll's WordPress exporter. I wanted to move from | |
// WordPress to Hugo with a relatively large number of posts; this gulpfile let | |
// me quickly process all the content files and get on with building the site. | |
var | |
gulp = require('gulp'), | |
replace = require('gulp-replace'), | |
rename = require('gulp-rename'), | |
entities = require('gulp-html-entities'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import MySQLdb, sys, time | |
# Lists out unused attribute options in a Magento DB | |
# This script generates an SQL query you can use but doesn't make any changes | |
# to DB on its own | |
db = MySQLdb.connect( | |
host="localhost", | |
user="root", | |
passwd="", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Delete option rows pointing to non-existent attributes | |
DELETE `option` | |
FROM `eav_attribute_option` AS `option` | |
LEFT JOIN `eav_attribute` | |
ON `eav_attribute`.`attribute_id` = `option`.`attribute_id` | |
WHERE `eav_attribute`.`attribute_id` IS NULL; | |
# Delete product attribute int rows pointing to non-existent attributes | |
DELETE `entity_int` | |
FROM `catalog_product_entity_int` AS `entity_int` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Obviously needs editing to suit situation! | |
rsync -rv --exclude="js" --exclude="css_secure" --exclude="css" --exclude="downloadable" --exclude="catalog" --exclude="import" broadmar@mceuk004-fs.nexcess.net:/home/broadmar/loveknitting.com/current/public/media/ ~/lk-media-download/ | |
aws s3 sync --recursive --acl="public-read" ~/lk-media-download s3://loveknitting-media/media |
NewerOlder