Skip to content

Instantly share code, notes, and snippets.

@maxosprojects
maxosprojects / main_windows.go
Created February 13, 2023 06:44 — forked from petemoore/main_windows.go
Running process as interactive user from windows service with UAC process elevation
package main
import (
"context"
"errors"
"fmt"
"log"
"os"
"os/exec"
"syscall"
@maxosprojects
maxosprojects / main.go
Created December 8, 2021 03:08 — forked from mholt/main.go
Example of run an interactive process on the current user from system service on windows (Golang)
package main
import (
"github.com/kardianos/service"
"log"
"flag"
)
type Service struct {}
@maxosprojects
maxosprojects / gist:48c08bea252d25b080fae861c5207f3e
Created April 15, 2020 01:47 — forked from specialcircumstances/gist:006629561b0941894934c1702c139efb
Driving LewanSoul LX-16A Serial Servo Directly from Particle Photon
// GIST to outline driving this very cost effective serial servos directly from Particle Photons
// Turns out the servo uses half duplex, and requires an Open Drain
// Turn off echo, or we can't read.
// According to my nScope although the docs say pull-up to 5V I can see it's a 3.3V that's 5V tolerant
// ... just like the photon...
// So, anyway, 3.3V works just fine. Link to the TX pin (that's Serial1). RX pin is unused.
// I used an external 10K pull-up to the 3.3V pin on the photon. You might be able to do this internally too?
//
// Power the servo separately to > 6V, so be a little careful with your wiring (cos the servo power will fry your serial pin)
@maxosprojects
maxosprojects / imageToText.gs
Created March 30, 2019 05:07 — forked from tagplus5/imageToText.gs
google apps script image to text ocr
function doGet(request) {
if (request.parameters.url != undefined && request.parameters.url != "") {
var imageBlob = UrlFetchApp.fetch(request.parameters.url).getBlob();
var resource = {
title: imageBlob.getName(),
mimeType: imageBlob.getContentType()
};
var options = {
ocr: true
};
@maxosprojects
maxosprojects / gist:f2e1fbcc620ccb5e6377e58543a8f78c
Created July 17, 2018 18:00 — forked from 0xF1o/gist:4179759
win32 GetLastInputInfo C# example
using System;
using System.Runtime.InteropServices;
using System.ComponentModel;
namespace GetLastUserInput
{
public class GetLastUserInput
{
private struct LASTINPUTINFO
{
@maxosprojects
maxosprojects / BlockChangeArray.java
Created November 6, 2017 21:12 — forked from aadnk/BlockChangeArray.java
Disguise a block (like a chest) as an arbitrary block.
package com.comphenix.example;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import org.bukkit.Location;
import org.bukkit.World;
/**
* Utility class for creating arrays of block changes.
@maxosprojects
maxosprojects / PlayServerMultiBlockChange.java
Created November 6, 2017 05:11 — forked from aadnk/PlayServerMultiBlockChange.java
Sending a WrapperPlayServerMultiBlockChange packet.
package com.comphenix.example;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
public class PlayServerMultiBlockChange extends JavaPlugin {
@Override
import math
lengthRearArm = 135.0
lengthForearm = 160.0
# Distance from joint3 to the center of the tool mounted on the end effector.
distanceTool = 50.9
heightFromBase = 80.0 + 23.0
maxDistance = lengthRearArm + lengthForearm
@maxosprojects
maxosprojects / dobot.py
Last active December 9, 2017 14:42
Dobot XYZ absolute (not additive) control
import serial
import time
import struct
import threading
import signal
class Dobot:
def __init__(self, port, baud=230400):
self.port = serial.Serial(port, baudrate=baud)
self.running = False