Skip to content

Instantly share code, notes, and snippets.

Lewis Walsh lewiswalsh

Block or report user

Report or block lewiswalsh

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@lewiswalsh
lewiswalsh / insert_from_tables.sql
Created Sep 3, 2018
Insert into table from two other tables on common field
View insert_from_tables.sql
INSERT INTO ab_product_categories (category_id, product_id)
SELECT c.id AS category_id, p.id as product_id
FROM ab_products AS p, ab_categories AS c
WHERE c.old_id = p.old_cat_id;
@lewiswalsh
lewiswalsh / gist:1c54b213541e8f13e497f1e3a20e8e14
Created Aug 12, 2018
See time and other stats about a command
View gist:1c54b213541e8f13e497f1e3a20e8e14
/usr/bin/time -v <your command or program with arguments>
@lewiswalsh
lewiswalsh / findpi.ps1
Created Aug 3, 2018
Find raspberry pi on the network
View findpi.ps1
arp -a | findstr b8-27-eb
@lewiswalsh
lewiswalsh / vob2mp4.sh
Created Jul 24, 2018
Convert DVD VOB files to MP4
View vob2mp4.sh
#!/bin/bash
ffmpeg -i "concat:VTS_01_1.VOB|VTS_01_2.VOB|VTS_01_3.VOB|VTS_01_4.VOB|VTS_01_5.VOB" -strict -2 outfile.mp4
View keybase.md

Keybase proof

I hereby claim:

  • I am lewiswalsh on github.
  • I am lewiswalsh (https://keybase.io/lewiswalsh) on keybase.
  • I have a public key ASCsSgDIC4Lp66CimJ8WmCzX70CIzBFMrsRhCx_Np_L4LAo

To claim this, I am signing this object:

View gist:97bf74b99e3cb612a8c935f95a96b695
{
"workbench.iconTheme": "vscode-icons",
"atomKeymap.promptV3Features": true,
"editor.multiCursorModifier": "ctrlCmd",
"editor.formatOnPaste": true,
"editor.fontSize": 11,
"editor.tabSize": 2,
"editor.fontFamily": "Hack, Consolas, 'Courier New', monospace",
"files.eol": "\n",
"editor.renderLineHighlight": "none",
@lewiswalsh
lewiswalsh / woocommerce_on_update.php
Created Apr 13, 2018
Do something when a woocommerce product is updated
View woocommerce_on_update.php
<?php
add_action( 'added_post_meta', 'mp_sync_on_product_save', 10, 4 );
add_action( 'updated_post_meta', 'mp_sync_on_product_save', 10, 4 );
function mp_sync_on_product_save( $meta_id, $post_id, $meta_key, $meta_value ) {
if ( $meta_key == '_edit_lock' ) { // we've been editing the post
if ( get_post_type( $post_id ) == 'product' ) { // we've been editing a product
$product = wc_get_product( $post_id );
// do something with this product
}
}
@lewiswalsh
lewiswalsh / dodyndns.sh
Created Feb 21, 2018
Update DigitalOcean domain record from bash.
View dodyndns.sh
#!/bin/bash
# Use CRON to regularly update for DIY DynDNS
PUBLIC_IPV4=$(curl ifconfig.co)
API_ACCESS_TOKEN=<your_access_token>
RECORD_ID=<your_record_id>
curl -X PUT -H "Content-Type: application/json" -H "Authorization: Bearer ${API_ACCESS_TOKEN}" -d '{"data":"'"${PUBLIC_IPV4}"'"}' "https://api.digitalocean.com/v2/domains/centralindustrial.co.uk/records/${RECORD_ID}"
@lewiswalsh
lewiswalsh / gist:96d7f7670d64e8328fbfcf8b309b56cd
Created Feb 6, 2018
Octoprint mjpg-streamer Raspberry Pi camera settings
View gist:96d7f7670d64e8328fbfcf8b309b56cd
camera_raspi_options="-x 1440 -y 1080 -fps 15 -quality 95 -sh 25 -br 60 -co 40 -sa 10 -awb fluorescent"
@lewiswalsh
lewiswalsh / gist:bad097f0ef96c33cb246b5b4830e4db8
Created Dec 16, 2017
GCode to raise extruder before heating
View gist:bad097f0ef96c33cb246b5b4830e4db8
G28 Z ; Home Z - LW
G0 Z50 ; Move Z to 50 - LW
You can’t perform that action at this time.