Skip to content

Instantly share code, notes, and snippets.

View sirolf2009's full-sized avatar

Floris Thijssen sirolf2009

  • Rotterdam, Netherlands
View GitHub Profile
function project
set rootPath "/mnt/c/projects"
set project (ls /mnt/c/projects/ | fzf)
cd "$rootPath/$project"
end
function undo-commit
git reset --soft HEAD~1
end
@sirolf2009
sirolf2009 / semantic-2.4.1.html
Created October 30, 2019 10:31 — forked from Miserlou/semantic-2.2.9.html
Semantic UI 2.2.9 CDN Starter
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8" />
<title>Semantic UI CDN</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/semantic.min.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/semantic.min.js"></script>
</head>
<body>
@sirolf2009
sirolf2009 / fix-ssh-keys
Last active October 4, 2019 11:45
a script to test and debug why your public key doesn't work. Run on remote. wget -q -O - https://gist.githubusercontent.com/sirolf2009/a7170d0a8a5283f3472a5a2515731b5f/raw/00e13f486057a2dbe592a8d7293e42ca0f64c9d9/fix-ssh-keys | bash
#!/bin/bash
echo "Fixing permissions"
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
FLAVOR=$(cat /etc/*release | grep "^NAME=" | cut -d \" -f2)
if [ "$FLAVOR" == "CentOS Linux" ]; then
echo "CentOS detected, fixing ACL on ~/.ssh"
import javafx.animation.KeyFrame
import javafx.animation.KeyValue
import javafx.animation.Timeline
import javafx.event.EventHandler
import javafx.geometry.Bounds
import javafx.scene.Node
import javafx.scene.input.ScrollEvent
import javafx.util.Duration
class AnimatedZoomOperator {
@sirolf2009
sirolf2009 / Driver.java
Last active February 26, 2019 13:50
WarningInputStream is an InputStream that you can wrap around another InputStream. It's purpose is
private void closeLingeringResources() { //make sure to run this at the end of whatever you're running. It should be part of a cleanup phase.
final List<InputStreamDescriptor> streams = new ArrayList<>();
WarningInputStream.retrieveAndClearInputs().forEach(value -> {
log.error("A resource was not closed\n" + value.describe());
streams.add(value);
});
streams.forEach(value -> {
getClosingService().submit(() -> {
try {
value.getStream().close();
pragma solidity ^0.5.0;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
**/
@sirolf2009
sirolf2009 / GapLineChart.java
Created January 3, 2019 10:06
JavaFX LineChart with gaps, use Double.NaN for gaps.
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import javafx.collections.ObservableList;
import javafx.scene.Node;
import javafx.scene.chart.Axis;
import javafx.scene.chart.LineChart;
import javafx.scene.shape.LineTo;
import javafx.scene.shape.MoveTo;
import javafx.scene.shape.Path;
#!/bin/bash
sudo apt-get --yes --force-yes update
sudo apt-get --yes --force-yes install software-properties-common git
sudo apt-add-repository --yes --force-yes ppa:fish-shell/release-2 -y
sudo apt-get --yes --force-yes update
sudo apt-get --yes --force-yes install fish
chsh -s /usr/bin/fish
echo /usr/bin/fish | sudo tee -a /etc/shells
curl -L https://get.oh-my.fish | fish
function progressbar
set WHITE "\e[1;37m"
set GREEN "\e[1;32m"
set GRAY "\e[0;38;2;100;100;100m"
set CLEAR "\e[0m"
set gaugeSize (expr $argv[3] - 2)
set coloredCharsCount (map $argv[1] 0 $argv[2] 0 $gaugeSize)
set coloredChars (seq -s= $coloredCharsCount|tr -d '[:digit:]')
set grayCharsCount (expr $gaugeSize - $coloredCharsCount)