Skip to content

Instantly share code, notes, and snippets.

View crysxd's full-sized avatar

Christian Würthner crysxd

View GitHub Profile
@crysxd
crysxd / macros.cfg
Created February 25, 2024 17:49
Switchwire Klipper config
## LDO recommended macros to get you started
# These macros are recommended by LDO
# You can copy these entries into your printer.cfg.
#
# Alternatively,
# You can copy these entries into your printer.cfg.
#
[gcode_macro M300]
@crysxd
crysxd / README.md
Last active August 27, 2022 18:00
Clear Trash of Adobe Creative Cloud

This is a super ugly Kotlin script to clear the entire trash of Adobe Creative Cloud. There is no "delete all option", so you are stuck with selecting files by shift-clicking and then watching your browser die. I used this script to delete 80.000 files in a few hours. I added some waits to not get flagged by some system, but not sure if needed.

As a dide note, not sure why but the number of "total" files did not constantly decrease although new files were returned every iteraration. It only seems to be an "visual" issue, files get constantly deleted.

While this script isn't copy + paste + run, you can adopt it to your needs and also easily translate it in other languages :) I actually did run this as a Android integration test.

You'll get the Bearer token by visiting creativecloud.adobe.com and then looking through the browser's

version: '3'
services:
octoprint:
image: octoprint/octoprint
ports:
- "5000:5000"
restart: unless-stopped
volumes:
@crysxd
crysxd / README.md
Last active February 20, 2024 19:06
Syncing Cura Settings & Profiles Accross multiple devices

Syncing Cura Settings & Profiles Accross multiple devices

I use multiple devices to control my 3D printer and it's alwys a hassle to move changes on profiles etc. between those machines leading to situations where I use an old version of my profiles to print a part because I just forgot to update it.

Here is how you can sync Cura settings between multiple devices:

  1. Setup Google Drive / OneDrive / Dropbox on every machine you want to sync the Cura settings on
  2. Go to the following location and copy the folder called cura to any convinient location inside your Google Drive / OneDrive / Dropbox folder. You can also rename the folder form cura to somthing else, I called mine Cura Settings.
  • Windows: %userprofile%\AppData\Roaming\cura
@crysxd
crysxd / test_product_search.sh
Created May 16, 2019 16:28
Shell snippet to test a Google Cloud Vision Product Set with a test image
# Install gcloud: https://cloud.google.com/sdk/docs/quickstarts
gcloud auth activate-service-account $GOOGLE_APPLICATION_CREDENTIALS
# Make sure to update the file path as well as project-id, location-id and product-set-id
curl -X POST \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
-H "Content-Type: application/json" \
https://vision.googleapis.com/v1/images:annotate -d "{
'requests': [
{
@crysxd
crysxd / test.js
Created May 11, 2019 11:56
Search for products with Google Cloud Vision Product Search
getSimilarProductsFile('your-project-id', 'your-location', 'your-product-set-id', 'your-product-category', 'your-test-image-path')
async function getSimilarProductsFile(
projectId,
location,
productSetId,
productCategory,
filePath,
filter
) {
@crysxd
crysxd / list.js
Last active May 16, 2019 16:48
List all product sets in Google Cloud Vision Product Search
list('your-project-id', 'your-location')
async function list(projectId, location) {
// Imports the Google Cloud client library
const vision = require('@google-cloud/vision');
// Creates a client
const client = new vision.ProductSearchClient();
/**
@crysxd
crysxd / import.js
Last active May 11, 2019 11:52
Google's sample node.js code to import a product set into Google Cloud Vision Product Search
importProductSets('your-project-id', 'your-location', 'gs://link/to/csv')
async function importProductSets(projectId, location, gcsUri) {
// Imports the Google Cloud client library
const vision = require('@google-cloud/vision');
// Creates a client
const client = new vision.ProductSearchClient();
/**
* TODO(developer): Uncomment the following line before running the sample.
@crysxd
crysxd / product-set.csv
Created May 11, 2019 11:28
Example of a CSV used to batch import a product set into Google Cloud Vision Product Search
image-uri image-id product-set-id product-id product-category product-display-name labels bounding-poly
gs://some-bucket.appspot.com/image1.jpg 7af4b4ab553e2273002637cc33d063b4efab7336 sneaker sneaker-1 apparel Awesome Sneaker Name style=554724-700,colorway=Black,retail_price=%24110,release_date=2019-04-01
gs://some-bucket.appspot.com/image2.jpg 9b735e511471f2aef80c43c344bd0165b40c0732 sneaker sneaker-2 apparel Other Sneaker Name style=554724-700,colorway=Black,retail_price=%24110,release_date=2019-04-01
gs://some-bucket.appspot.com/image3.jpg b91e552ca138c7c59c87ac06416cb2c71abe3627 sneaker sneaker-2 apparel Other Sneaker Name style=554724-700,colorway=Black,retail_price=%24110,release_date=2019-04-01
@crysxd
crysxd / ExampleActivity.java
Last active February 8, 2019 13:13
Requesting Android M 6.0 permission with couple of lines
...
public class ExampleActivity extends AppCompatActivity {
public void onClick(View v) {
// This example shows how to request CALL_PHONE and READ_CALENDAR and do some stuff with the permissions
// The user will only be prompted for the permissions he not yet has granted
new PermissionRequestManager()