Skip to content

Instantly share code, notes, and snippets.

View chrisduran's full-sized avatar

Chris Duran chrisduran

View GitHub Profile
@chrisduran
chrisduran / profiles.json
Last active September 22, 2019 22:27
Windows Terminal profile with colorscheme for Terminal.app
{
"globals" :
{
"alwaysShowTabs" : true,
"copyOnSelect" : false,
"defaultProfile" : "{c6eaf9f4-32a7-5fdc-b5cf-066e8a4b1e40}",
"initialCols" : 120,
"initialRows" : 30,
"keybindings" :
[
@chrisduran
chrisduran / .zsh_command_not_found
Last active September 6, 2019 11:44
ZSH Config
# (c) Zygmunt Krynicki 2007,
# Licensed under GPL, see COPYING for the whole text
# Modified to actually show error commands, because that is sensible
#
# This script will look-up command in the database and suggest
# installation of packages available from the repository
if [[ -x /usr/lib/command-not-found ]] ; then
if (( ! ${+functions[command_not_found_handler]} )) ; then
function command_not_found_handler {
@chrisduran
chrisduran / README.md
Created August 21, 2019 08:25
Eject/Close CD Drive in Windows (Python)

For Python 3.7.x:

Assumes you only have a single optical drive, only tested under Windows 10. Exploits the quirk that the C callback takes a much shorter period of time to return if the drive is already open, then it does when opening (presumably waits until the drive reports a successful opening somehow). It assumes that if the time passed after an opening command is below a certain value (1.0), then the drive is already open and needs closing.

You may need to change the float value on line 5 if your drive opens super quick. (I was getting values between 0.1-0.3 when already open, and 2.0+ when closed).

@chrisduran
chrisduran / SimpleSwingBrowser.java
Created July 22, 2014 22:22
Implementation of embedding the JavaFX webview within the Swing UI framework. From the following example: http://docs.oracle.com/javafx/2/swing/swing-fx-interoperability.htm#CHDIEEJE
package com.biomatters.sandbox;
import javafx.application.Platform;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.embed.swing.JFXPanel;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebEvent;