Skip to content

Instantly share code, notes, and snippets.

View wess's full-sized avatar
💭
When am I not writing code?

Wess Cope wess

💭
When am I not writing code?
View GitHub Profile
@wess
wess / Cargo.toml
Last active December 9, 2020 15:20
[package]
name = "layerkeep-api"
version = "0.0.1"
authors = ["wess <me@wess.io>"]
edition = "2018"
[dependencies]
tide = "0.15.0"
tera = "1.5.0"
tide-tera = "0.2.2"
@wess
wess / model.rs
Created November 12, 2020 15:13
Feed backs, please
use serde::{Serialize};
use mongodb::bson::{
to_bson,
Bson,
};
pub trait Model : Serialize {
fn to_bson(&self) -> Bson {
to_bson(self).unwrap()
pub fn auth_request<'a>() -> AuthorizationRequest<'a> {
let config = Config::env();
let scopes:Vec<String> = config.github.scope;
let request =
client()
.authorize_url(CsrfToken::new_random);
for scope in scopes.iter() {
request.add_scope(
@wess
wess / hex.rs
Created October 29, 2020 20:22
let hex_string = match hex.len() {
3 => format!(
"{}{}{}{}{}{}",
&hex[..1],
&hex[..1],
&hex[1..2],
&hex[1..2],
&hex[2..3],
&hex[2..3]
),
project: MyPlatform
repos:
- https://github.com/....git
- https://github.com/....git
- https://github.com/....git
dependencies:
- postgresql@latest
- rust@1.46.0
;(function(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _defaults = _interopRequireDefault(require("axios/lib/defaults"));
@wess
wess / gist:5161817
Last active December 13, 2019 17:33
Getting visible range of text for a UITextView
@implementation UITextView (Annex)
@dynamic visibleTextRange;
- (NSRange)visibleTextRange
{
CGRect bounds = self.bounds;
CGSize textSize = [self.text sizeWithFont:self.font constrainedToSize:bounds.size];
UITextPosition *start = [self characterRangeAtPoint:bounds.origin].start;
How to Calibrate E-Steps (can be added to firmware)
M503 ; See current steps
M83 ; Set extruder to relative mode
M109 S240 ; Warm up the nozzle to 240C for PETG. Use 200 for PLA.
G1 E100 F100 ; Extrude 100mm at 100mm/min. In my case, only 89mm extruded and my current settings at the time was the default 93. 100 (desired) / 89 (actual) * 93 (current) = 104.49
M92 E104.49 ; Set steps to 104.49mm / 100mm
M500 ; Save settings to EEPROM
/**
* Disable all Volumetric extrusion options
*/
//#define NO_VOLUMETRICS
#if DISABLED(NO_VOLUMETRICS)
/**
* Volumetric extrusion default state
* Activate to make volumetric extrusion the default method,
#!/bin/bash
# Run this script in display 0 - the monitor
export DISPLAY=:0
# Hide the mouse from the display
unclutter &
# If Chrome crashes (usually due to rebooting), clear the crash flag so we don't have the annoying warning bar
sed -i 's/"exited_cleanly":false/"exited_cleanly":true/' /home/pi/.config/chromium/Default/Preferences