Skip to content

Instantly share code, notes, and snippets.

View oderwat's full-sized avatar
💭
Go da Lang...

Hans Raaf oderwat

💭
Go da Lang...
View GitHub Profile
@oderwat
oderwat / eject-usb.sh
Created March 28, 2013 16:54
Hier ein Script, das ich für und mit @tekshrek gebaut habe um bei ihm eine externe Platte die an der #Synology NAS hängt "remote" vom Mac auswerfen zu können. Das Script selber gehört auf die Synology und ist mit Hilfe verschiedener Informationen aus dem Forum gezaubert! Anwendung: In der Synology z.B. unter /root/eject-usb.sh ablegen (chmod u+x…
#!/bin/sh
# I have this as /root/eject-usb.sh and execute it from the mac by ssh with keypair
# With no parameters we list the currently mounted devices
if [ -z "$1" ]
then
# Listing mounted USB Drives
/usr/syno/bin/synousbdisk -enum
exit 0
@oderwat
oderwat / gist:9158840
Created February 22, 2014 17:45
GoLang HTTP PUT / DELETE (just copied from somewhere else!)
package main
import (
"encoding/json"
"fmt"
"net/http"
"net/url"
)
const (
@oderwat
oderwat / pa-test-0.0-to-0.6-220C-50C-1.75-0.4-bed-220x200.gcode
Created June 4, 2018 22:57
Example GCode of Klipper Pressure Advance Test produced by my gcwiz tool
; gcode made by gcwiz (c) 2018 Hans Raaf / GitHub: OderWat
;
; Notice: This can't be printed with S3D because it does not accept
; the Klipper specific code. Use OctoPrint or try some other host.
G28
G1 Z5 F1500
; printing 20 sections for pa from 0.0000 to 0.6000 in steps of 0.0300
; first layer is 0.100 mm, other layers are 0.200 mm, total height is 40.000 mm
; changing pressure_advance every 2.000 mm (every 10 layers of a total of 200 layers)
G1 X5 Y10 F9000
@oderwat
oderwat / Naivebayes.go
Created April 23, 2022 02:43 — forked from caongocthai/Naivebayes.go
Sentiment Analysis: Naive Bayes Classifier from scratch in Golang
package main
// The string values of the 2 classes
// They can be "positive" >< "negative" as in this example
// They can also be "ham" >< "spam", i.e.
const (
positive = "positive"
negative = "negative"
)
@oderwat
oderwat / strAccessObj.nim
Last active March 16, 2020 15:06
Access Objects in Nim by strings for fields (wrapper automatisation)
import macros
type Foo = object
a: int
b: int
c: float
#[
dumpTree:
@oderwat
oderwat / BearGrabber.js
Created November 16, 2017 23:16
Safe Bear URL Grabber Scriptlet
javascript:location.href='bear://x-callback-url/add-text?title=URL-Grabber&mode=prepend&text='+encodeURIComponent('['+document.title+']('+location.href+")")
Verifying my Blockstack ID is secured with the address 1BF3BhUZaQeRc5jjW1TczSDpvnsNdyVDGg https://explorer.blockstack.org/address/1BF3BhUZaQeRc5jjW1TczSDpvnsNdyVDGg
@oderwat
oderwat / BearFocus.scpt
Created October 22, 2017 11:50
Little Script which tells Bear to focus the window, reset it's state and place the cursor in the search field
tell application "System Events" to tell process "Bear"
set frontmost to true
-- show all notes
click menu item 1 of menu 1 of menu bar item 5 of menu bar 1
-- search in (all) notes
click menu item 1 of menu 1 of menu item 22 of menu 1 of menu bar item 4 of menu bar 1
tell application "System Events"
-- press delete to clear the search field
key code 51
-- press tab to switch to note list
@oderwat
oderwat / soabb.js
Created September 26, 2017 12:01
Spiegel Online AdBlocker-Blocker
// ==UserScript==
// @name Spiegel Online AddBlocker removal
// @namespace http://oderwat.de/soabrem
// @version 0.1
// @description I hate adblocker
// @author H. Raaf
// @match www.spiegel.de/*
// @grant none
// @run-at document-start
// ==/UserScript==
@oderwat
oderwat / spiderarc
Last active August 23, 2017 21:34
Script for single archival of locations with SpiderOakONE which stops and starts the application as needed
#!/usr/bin/env osascript
#
# Script for easy archival of single targets while the
# SpiderOakONE Application is running.
#
# Written by H.Raaf (c) 2017 / MIT LICENSE
#
# https://gist.github.com/oderwat/6b790effbf955300aaeaa76a462e6e2a
#
# This script is meant to be saved to ~/bin or /usr/local/bin as spiderarc