Skip to content

Instantly share code, notes, and snippets.

@foofoodog
foofoodog / nuke.cmd
Last active August 29, 2015 14:26
Rip and replace OctoPrint
#!/usr/bin/env bash
cd ~
sudo service octoprint stop
sudo rm -Rf OctoPrint
sudo rm -Rf .octoprint
sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get -y install python-pip python-dev python-setuptools python-virtualenv git libyaml-dev
git clone https://github.com/foosel/OctoPrint.git
cd OctoPrint
@foofoodog
foofoodog / Octoprint on windows
Last active August 29, 2015 14:22
Octoprint on windows
Requires Python 2.7 assumed to be at C:\Python27.
Assumes global Python install has pip and virtualenv and maybe other stuff.
Either git clone or unzip the repo files somewhere.
Assuming you are bleeding edge and want to try the dev branch https://github.com/foosel/OctoPrint/archive/devel.zip.
Assuming here that you unzipped it to c:\Temp and now have this directory C:\Temp\OctoPrint-devel\OctoPrint-devel.
Hint: Text after the colon in the commands below can be pasted into the cmd window.
Hint: To paste to the cmd window press [alt]+[space],e,p in the cmd window.
@foofoodog
foofoodog / octonag.diff
Last active August 29, 2015 14:15
Intercept KO click bindings and add confirmation where desired in OctoPrint
Index: src/octoprint/static/js/app/confirm.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/octoprint/static/js/app/confirm.js (revision )
+++ src/octoprint/static/js/app/confirm.js (revision )
@@ -0,0 +1,36 @@
+(function() {
+ var originalInit = ko.bindingHandlers.click.init;
@foofoodog
foofoodog / 3dwatch.cs
Last active August 29, 2015 14:12
Watch a folder for STL files, slice them, then upload the gcode to Octoprint
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
// csc 3dwatch.cs /r:System.Net.Http.dll
// Run this in a directory where there is a slic3r.ini and where STL or gcode files will be created.
@foofoodog
foofoodog / Octo.cs
Last active January 22, 2022 09:25
Read only C# wrapper for OctoPrint API
/*
// OctoPrint API wrapper
// csc /target:library Octo.cs /r:System.Net.Http.dll
// linqpad
var server = "http://localhost:5000";
// print3r.Reader<print3r.Logs.Result>.Read(server).Dump();
// print3r.Reader<print3r.Connection.Result>.Read(server).Dump();
// print3r.Reader<print3r.Files.Result>.Read(server).Dump();
// print3r.Reader<print3r.Job.Result>.Read(server).Dump();
// print3r.Reader<print3r.Printer.Result>.Read(server).Dump();
@foofoodog
foofoodog / Library
Last active December 16, 2015 21:09
Library of some stuff
Library of some stuff
@foofoodog
foofoodog / fiddle.css
Last active December 16, 2015 21:00
jsfiddle test
body, button {
/* brilliant UX */
font-family :"Comic Sans MS"
}
@foofoodog
foofoodog / PasswordReset.cshtml.patch
Created November 30, 2012 17:44
Patch for ASP.NET Web Site (Razor v2) Visual C# - Account\PasswordReset.cshtml - broken and erroneous validation.
--- OLD_PasswordReset.cshtml
+++ NEW_PasswordReset.cshtml
@@ -14,13 +14,13 @@
bool isSuccess = false;
// Setup validation
Validation.RequireField("newPassword", "The new password field is required.");
Validation.Add("confirmPassword",
Validator.EqualsTo("newPassword", "The new password and confirmation password do not match."));
- Validation.RequireField("passwordResetToken", "The password reset token field is required.");
@foofoodog
foofoodog / powershell-winform.ps1
Created July 8, 2012 13:52
powershell-winform
New-Module -ScriptBlock {
[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null
$form = New-Object System.Windows.Forms.Form
$grid = New-Object System.Windows.Forms.PropertyGrid
$grid.Dock = [System.Windows.Forms.DockStyle]::Fill
$button = New-Object System.Windows.Forms.Button
$button.Text = "OK"
$button.Dock = [System.Windows.Forms.DockStyle]::Bottom
@foofoodog
foofoodog / UnitTest1.cs
Created May 26, 2012 02:36
Super simple sharepoint list item ORM.
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.SharePoint;
namespace TestProject2
{
[TestClass]
public class UnitTest1