Skip to content

Instantly share code, notes, and snippets.

@Alex-Schaefer
Alex-Schaefer / bambu-ssdp-discovery.py
Last active March 16, 2025 20:41
Python implementation to send a fake SSDP discovery message to Bambu Studio or Orca Slicer
# Derived from this: https://github.com/gashton/bambustudio_tools/blob/master/bambudiscovery.sh
# Python implementation without need for linux
# Send the IP address of your BambuLab printer to port 2021/udp, which BambuStudio is listens on.
# Ensure your PC has firewall pot 2021/udp open. This is required as the proper response would usually go to the ephemeral source port that the M-SEARCH ssdp:discover message.
# But we are are blindly sending a response directly to the BambuStudio listening service port (2021/udp).
# Temporary solution to BambuStudio not allowing you to manually specify the Printer IP.
# Usage:
@psxdev
psxdev / gist:c99eebd3c8b85f2eb7a288eee74cf4b1
Created June 11, 2022 21:45
Playing with bd-j on macos bigsur on m1
references https://hdcookbook.jovial.com/
the github project was updated for m1 last year:
https://github.com/zathras/java.net
1) You will need ant and java sdk
for java this is using 1.8, it is old stuff and the author update to build all fine on m1 so
java download zulu openjdk sdk 1.8.0_302 select 8u302b08 Azul Zulu: 8.56.0.23 form macos arm64 from:
https://www.azul.com/downloads/?version=java-8-lts&os=macos&architecture=arm-64-bit&package=jdk&show-old-builds=true
ant get the 1.10.12 version from:
https://ant.apache.org/bindownload.cgi
2)i choose the tar.gz option to place all in my custom directories, you can use a script like
@tivaliy
tivaliy / timezone_posix_mapping.py
Last active February 6, 2025 10:45
Timezone Id to POSIX format mapping
{
'Africa/Abidjan': 'GMT0',
'Africa/Accra': 'GMT0',
'Africa/Addis_Ababa': 'EAT-3',
'Africa/Algiers': 'CET-1',
'Africa/Asmara': 'EAT-3',
'Africa/Asmera': 'EAT-3',
'Africa/Bamako': 'GMT0',
'Africa/Bangui': 'WAT-1',
'Africa/Banjul': 'GMT0',
@th0r
th0r / angular-in-view-directives.html
Last active February 9, 2023 17:45
Angular `InView` directives
<!-- wInViewRoot directive is needed to specify the `root` for `IntersectionObserver` and some other it's options e.g. `margin` -->
<div class="container" wInViewRoot="viewport">
Any content can be here
<w-in-view-item>
<!-- Content will be replaced by a placeholder <div> with the same height as original content.
Also `InViewItemComponent`s change detector will be detached when it become invisible which means
all the content's change detectors won't be reachable and will be inactive as well. -->
</w-in-view-item>
...or any other content can be here
<w-in-view-item>
@CelliesProjects
CelliesProjects / structToFile.ino
Last active March 30, 2025 11:19
Read and write a c++ struct to a file. Arduino IDE. ESP32.
/*
* EXAMPLE READING AND WRITING A C++ STRUCT TO A FILE
*/
#include <FS.h>
#include <FFat.h>
const char *fileName = "/somefile.txt";
struct aStruct {
char someString[11];
@OliverJAsh
OliverJAsh / foo.ts
Last active November 7, 2019 06:42
TypeScript URL helpers
import urlHelpers, { Url, UrlWithParsedQuery, UrlWithStringQuery } from 'url';
import queryStringHelpers from 'querystring';
import { Option } from 'funfix-core';
import pipe from 'lodash/flow';
import { ParsedUrlQuery } from 'querystring';
const isNonEmptyString = (str: string) => str.length > 0;
// https://github.com/gcanti/fp-ts/blob/15f4f701ed2ba6b0d306ba7b8ca9bede223b8155/src/function.ts#L127
const flipCurried = <A, B, C>(fn: (a: A) => (b: B) => C) => (b: B) => (a: A) =>
@ivenmarquardt
ivenmarquardt / lazy-evaluation.js
Last active May 18, 2018 20:37
Lazy evaluation, lazy getters, eta reduction, function composition, implicit thunks through deferred type
// Lazy Getters
/* What enables Tail Recursion Modulo Cons in Javascript is a thunk in Weak Head Normal Form.
An expression in weak head normal form has been evaluated to the outermost data constructor,
but contains sub-expressions that may not have been fully evaluated. In Javascript only thunks
can prevent sub-expressions from being immediately evaluated. */
const cons = (head, tail) => ({head, tail});
ngOnInit() {
this.filteredRoutes$ = from(this.routes).pipe(
concatMap((route) => {
// handle if nothing is in canActivate
if (!route.canActivate || !route.canActivate.length) {
// create an object that has the route and result for filtering
return of({ route, result: true });
}
return from(route.canActivate).pipe(
git fetch -p && for branch in `git branch -vv --no-color | grep ': gone]' | awk '{print $1}'`; do git branch -D $branch; done