Skip to content

Instantly share code, notes, and snippets.

@nlowe
nlowe / Controller.java
Last active July 11, 2018 16:07
JavaFX Table Cell Progress Bar in CSS
import javafx.fxml.Initializable;
import javafx.scene.control.Slider;
import javafx.scene.control.TableCell;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import java.net.URL;
import java.util.ResourceBundle;
public class Controller implements Initializable {
@stephanetimmermans
stephanetimmermans / ubuntu-compass-ruby
Last active July 4, 2019 12:48
Install Compass+Ruby on Ubuntu 14.04
#https://gorails.com/setup/ubuntu/14.04
sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties
sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev
curl -L https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
echo "source ~/.rvm/scripts/rvm" >> ~/.bashrc
rvm install 2.1.2
rvm use 2.1.2 --default
@dantheman213
dantheman213 / aws-ssm-find-param
Last active August 19, 2019 17:56
Quickly find AWS SSM params by partial search, use custom AWS profiles, get an interactive result to query, and get a AWS URL to view and edit target
#!/usr/bin/env node
//
// Quickly find AWS SSM params by partial search, use custom AWS profiles, get an interactive
// result to query, and get a AWS URL to view and edit target.
//
// Requires AWS CLI, NodeJS v10+ and Python 2/3
//
// Before running for first time do:
// npm install inquirer
@dantheman213
dantheman213 / Great GNU Screen config
Last active March 13, 2020 05:31
GNU Screen configuration file that helps to optimize your experience
# GNU Screen
# Preferred Configuration File
# Turn off start up message
startup_message "off"
# Allow bold colors
attrcolor b ".I"
# Tell screen how to set colors. AB = background, AF=foreground
@dantheman213
dantheman213 / docker_cheat_sheet_readme.MD
Last active April 27, 2020 00:43
Docker Cheat Sheet

Docker Cheat Sheet

Copy file from container to host

docker cp <containerId>:/file/path/within/container /host/path/target

Stop all running containers

docker stop $(docker ps -aq)
@dantheman213
dantheman213 / install_great_gnu_screen_config.sh
Last active May 10, 2020 05:05
Download a great Gnu Screen config straight to your current user's environment
#
# Download a great Gnu Screen config straight to your current user's environment
#
# Just paste that in wherever env you're at and run `screen` and you'll have a good configuration with a status bar,
# tabs, no warning screen, beeps/bells/alerts, and more.
#
# Screen Config (.screenrc) located here:
# Gist: https://gist.github.com/dantheman213/8df6fabb1bc6fc192c9e
# Raw: https://gist.githubusercontent.com/dantheman213/8df6fabb1bc6fc192c9e/raw/bfd65a3695974b94223849c516b5b58828932613/Great%2520GNU%2520Screen%2520config
@samelie
samelie / ffmpeg last frame video
Created February 18, 2015 09:49
ffmpeg last frame of video
#!/bin/bash
fn="$1"
of=`echo $1 | sed s/mp4/jpg/`
lf=`ffprobe -show_streams "$fn" 2> /dev/null | grep nb_frames | head -1 | cut -d \= -f 2`
rm -f "$of"
let "lf = $lf - 1"
ffmpeg -i $fn -vf select=\'eq\(n,$lf\) -vframes 1 $of
@gotev
gotev / AllCertificatesAndHostsTruster.java
Last active February 15, 2021 00:52
Use self-signed certificates in Java and Android (development only!)
import android.util.Log;
import java.security.SecureRandom;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSession;
@yanzhihong23
yanzhihong23 / pm2-guard.js
Created April 28, 2017 10:24
pm2 cpu guard
'use strict';
const later = require('later');
const logger = require('./logger')('guard');
const pm2 = require('pm2');
const schedule = later.parse.recur().every(10).second();
// set local timezone
later.date.localTime();
@danielbachhuber
danielbachhuber / gist:7126249
Last active December 21, 2021 15:46
Include posts from authors in the search results where either their display name or user login matches the query string
<?php
/**
* Include posts from authors in the search results where
* either their display name or user login matches the query string
*
* @author danielbachhuber
*/
add_filter( 'posts_search', 'db_filter_authors_search' );
function db_filter_authors_search( $posts_search ) {