Skip to content

Instantly share code, notes, and snippets.

@ansonl
ansonl / logscale.vrt
Last active July 28, 2023 23:07
pixelFunctionTest.py
<VRTDataset rasterXSize="9002" rasterYSize="5857">
<SRS dataAxisToSRSAxisMapping="1,2">PROJCS["USA_Contiguous_Lambert_Conformal_Conic",GEOGCS["NAD83",DATUM["North_American_Datum_1983",SPHEROID["GRS 1980",6378137,298.257222101004,AUTHORITY["EPSG","7019"]],AUTHORITY["EPSG","6269"]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4269"]],PROJECTION["Lambert_Conformal_Conic_2SP"],PARAMETER["latitude_of_origin",39],PARAMETER["central_meridian",-96],PARAMETER["standard_parallel_1",33],PARAMETER["standard_parallel_2",45],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["Easting",EAST],AXIS["Northing",NORTH]]</SRS>
<GeoTransform> -1.4748244013199583e+05, 2.5000000000000000e+02, 0.0000000000000000e+00, 7.4684201824673638e+05, 0.0000000000000000e+00, -2.5000000000000000e+02</GeoTransform>
<VRTRasterBand dataType="Float32" band="1" subClass="VRTDerivedRasterBand">
<NoDataValue>-32768</NoDataValue>
@ansonl
ansonl / stepper.cpp
Created January 5, 2023 00:13
marlin2 stepper w/ input shaping change that breaks stepper motor operation
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@ansonl
ansonl / stepper.cpp
Created January 5, 2023 00:10
marlin2 stepper w/o input shaping changes
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@ansonl
ansonl / annealing-gcode-generator.py
Created April 16, 2022 02:37
Annealing GCODE generator
# Annealing GCODE generator by Anson Liu
# Best results with a glass bed with annealingTemp set to the greater of buildplate print temp or material specified anneal temp
annealTemp = 110
annealMinutes = 60 * 4
endAnnealTemp = 50
print (';Generated Annealing GCODE from Annealing GCODE generator by Anson Liu ansonliu.com')
print('M300 ;play beep for plastic container reminder')
@ansonl
ansonl / positiveWords.txt
Created September 5, 2016 19:57
Hu and Liu's Positive Opinion Lexicon (only correctly spelled words)
Positive Opinion Lexicon: by Minqing Hu and Bing Liu from https://www.cs.uic.edu/~liub/FBS/sentiment-analysis.html
Intentionally misspelled words have been removed from the original list. Correctly spelled word list is below:
A+
Abound
Abounds
Abundance
Abundant
Accessable
@ansonl
ansonl / extract_rtf.py
Last active August 20, 2016 22:30
Function to extract text in RTF files. Modified to show the text of hyperlinks by removing 'field' and 'fldrslt' from ignored destination words.
# -*- coding: utf-8 -*-
"""
Extract text in RTF Files. Refactored to use with Python 3.x
Source:
http://stackoverflow.com/a/188877
Code created by Markus Jarderot: http://mizardx.blogspot.com
"""
#!/bin/sh
#download required source control
sudo apt-get install git mercurial htop
#setup Go lang
cd ~
wget https://storage.googleapis.com/golang/go1.6.2.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.6.2.linux-amd64.tar.gz
#set envvars
@ansonl
ansonl / house
Created October 15, 2014 18:19
Lobbyist Lookup House structs
type HouseLobbyist struct {
FirstName string `xml:"lobbyistFirstName"`
LastName string `xml:"lobbyistLastName"`
}
type HouseFiling struct {
OrganizationName string `xml:"organizationName"`
ClientName string `xml:"clientName"`
SenateID string `xml:"senateID"`
HouseID string `xml:"houseID"`
@ansonl
ansonl / go-charset
Created October 15, 2014 18:16
Lobbyist Lookup Go-Charset library snippet UTF-16 to UTF-8
func convertEncoding(input []byte) []byte {
reader, err := charset.NewReader("utf16", strings.NewReader(string(input)))
if err != nil {
log.Fatal(err)
}
output, err := ioutil.ReadAll(reader)
if err != nil {
log.Fatal(err)
}
return output
@ansonl
ansonl / senate
Created October 15, 2014 18:14
Lobbyist Lookup Senate structs
type SenateRegistrant struct {
RegistrantName string `xml:",attr"`
RegistrantID string `xml:",attr"`
RegistrantCountry string `xml:",attr"`
}
type SenateClient struct {
ClientName string `xml:",attr"`
ClientID string `xml:",attr"`
ContactFullname string `xml:",attr"`
IsStateOrLocalGov bool `xml:",attr"`