Skip to content

Instantly share code, notes, and snippets.

@jdembowski
jdembowski / wp-rest-api-example.py
Last active Apr 26, 2021
Use cookie authentication to obtain a nonce for WP REST API calls that need authentication.
View wp-rest-api-example.py
#!/usr/bin/python3
# This Python script will
#
# - Log into a WordPress installation using supplied credentials.
# - Get a single published post using the REST call /wp/v2/posts
# - Get a valid nonce from '/wp-admin/post.php?post=xxx&action=edit'
# - Use cookie+nonce to retrieve on post in draft status via REST.
#
# Getting that valid nonce must be performed prior to each WP REST call
@jdembowski
jdembowski / Configuration.h
Created Jun 19, 2019
Anycubic Delta Linear with inductive probe
View Configuration.h
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@jdembowski
jdembowski / Configuration_adv.h
Created Jan 18, 2019
Wanhao Duplicator i3 V2 Configuration_adv.h for Marlin 1.1.9
View Configuration_adv.h
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@jdembowski
jdembowski / Configuration.h
Created Jan 18, 2019
Wanhao Duplicator i3 v2 Marlin 1.1.9 Configuration.h file
View Configuration.h
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
View domain-ip-check.py
#!/usr/bin/python
# This will need the investigate module installed via 'pip install investigate'
import investigate, json, fileinput, codecs, sys, os, requests, time, re
def slice(l, n):
n = max(1, n)
return [l[i:i + n] for i in range(0, len(l), n)]
# Read key, single line
with open('api-key.txt', 'r') as k:
@jdembowski
jdembowski / functions.php
Created Jul 22, 2018
Doctorial Child theme functions.php file
View functions.php
<?php
add_action( 'wp_enqueue_scripts', 'doctorial_child_enqueue_styles' );
function doctorial_child_enqueue_styles() {
$parent_style = 'parent-style';
wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'child-style',
@jdembowski
jdembowski / style.css
Created Jul 22, 2018
Child theme style.css file for Doctorial
View style.css
/*
Theme Name: Doctorial Child theme
Description: A Child theme to remove the theme author's credits from the theme's footer
Version: 0.1
Template: doctorial
*/
View https-new-sites.php
<?php
/*
Plugin Name: Make new sites in the network with https URLs
Description: Force new sites in a multisite network to use HTTPS as the scheme.
Plugin Author: Jan Dembowski
This probably should not be necessary and the scheme should be picked up
by WordPress. But I could not get my new sites to use https so here I am.
View Monoprice Maker Select V2 Slic3r G-code
Slic3r 1.2.9
Start G-code
M116 ; Wait until target temperatures for extruder and heated bed are reached
G28 ; home all axes
M117 Printing...
G0 Z0.3 ; drop to start height
G0 Y3 ; move to edge of print area
G0 X50 F5000 ; move to front of bed
@jdembowski
jdembowski / bulk-enforcement.py
Last active Aug 1, 2018
Enforcement API excercise
View bulk-enforcement.py
#!/usr/bin/python
# This will need the investigate module installed via 'pip install investigate'
import investigate, json, fileinput, codecs, sys, os, requests, time, re
def slice(l, n):
n = max(1, n)
return [l[i:i + n] for i in range(0, len(l), n)]
# Read key, single line
with open('api-key.txt', 'r') as k: