Skip to content

Instantly share code, notes, and snippets.

@connornishijima
connornishijima / christmas_light_fixer.h
Created December 9, 2023 22:05
Christmas Light Fixer (Incandescent LUT)
// This function reduces harsh blue tones in RGB LED lights, bringing
// them closer to the look of retro tinted incandescent bulbs.
//
// All input colors to the christmas_light_fixer() function are multiplied
// by a LUT of a warm white, reducing the power of the blue spectrum while
// preserving the brightness of the yellow spectrum.
CRGB christmas_light_fixer( CRGB input_color ){
CRGB incandescent_lookup = CRGB( 255, 113, 40 );
CRGB out_color = input_color;
@juanqui
juanqui / bed.g
Last active August 26, 2021 16:14
CR-10 S4 Duet2Wifi Config w/ BLTouch and AC Heated Bed
M561 ; clear any bed transform
G29 S2 ; Clear bed height map
; Probe 2-points
M401 ; Deploy probe - deployprobe.g
G30 P0 X20 Y200 Z-9999 ; Center Left
G30 P1 X340 Y200 Z-9999 S2 ; Center Right
M402 ; Retract Probe - retractprobe.g
@klingtnet
klingtnet / enable-hibernate-arch-linux.md
Created November 22, 2016 17:23
Enable hiberate in Arch Linux usind kernel 4+, grub2 and a swapfile

This guide is based on the hibernate article from the Arch wiki.

  • edit /etc/default/grub and add resume as well as resume_offset kernel parameters
    • resume=UUID=abcd-efgh contains the UUID of the partition on which the swapfile resides. In most cases the swapfile resides in root, to identify the root parition's UUID run blkid or lsblk -O.
    • resume_offset=1234 is the offset of the swapfile from the partition start. The offset is the first entry in the physical_offset column of the output of filefrag -v /swapfile.
    • update grub: grub-mkconfig -o /boot/grub/grub.cfg
    • example: GRUB_CMDLINE_LINUX_DEFAULT="resume=UUID=75972c96-f909-4419-aba4-80c1b74bd605 resume_offset=1492992"
  • add the resume module hook to /etc/mkinitcpio.conf:
    • HOOKS="base udev resume autodetect ...
  • rebuild the initramfs mkinitcpio -p linux
@fchollet
fchollet / classifier_from_little_data_script_3.py
Last active July 23, 2024 16:32
Fine-tuning a Keras model. Updated to the Keras 2.0 API.
'''This script goes along the blog post
"Building powerful image classification models using very little data"
from blog.keras.io.
It uses data that can be downloaded at:
https://www.kaggle.com/c/dogs-vs-cats/data
In our setup, we:
- created a data/ folder
- created train/ and validation/ subfolders inside data/
- created cats/ and dogs/ subfolders inside train/ and validation/
- put the cat pictures index 0-999 in data/train/cats
@james-d
james-d / EditCell.java
Created February 13, 2015 03:18
(Fairly) reusable edit cell that commits on loss of focus on the text field. Overriding the commitEdit(...) method is difficult to do without relying on knowing the default implementation, which I had to do here. The test code includes a key handler on the table that initiates editing on a key press.
import javafx.event.Event;
import javafx.scene.control.ContentDisplay;
import javafx.scene.control.TableCell;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableColumn.CellEditEvent;
import javafx.scene.control.TablePosition;
import javafx.scene.control.TableView;
import javafx.scene.control.TextField;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
@vedant
vedant / gist:9333992
Last active September 26, 2024 01:23
Export note files from Google Keep
/* Vedant Misra (vedantmisra.com) (github.com/vedant)
*
* Script for exporting Google Keep note files.
*
* This does not handle attachments or checklists, only note files. Downloads
* each note to a .txt file named for the note's title.
*
* To use this, go to https://drive.google.com/keep/ and wait for the page to
* fully load all of your saved notes; scroll to the bottom to confirm they're
* loaded. Then paste the below in your URI bar, go to the start of the line,
@willurd
willurd / web-servers.md
Last active October 19, 2024 23:24
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000