Skip to content

Instantly share code, notes, and snippets.

@jaapie
jaapie / update-ads
Last active October 23, 2022 23:29
A simple bash script for Debian-based systems that downloads the latest version of Azure Data Studio and installs it. Requires the html-xml-utils package to be installed
#!/bin/bash
if [ "$EUID" -ne 0 ]
then echo "error: you must be root to run this script"
exit
fi
FILENAME=/tmp/azuredatastudio-latest.deb
LINK=$(curl -s "https://learn.microsoft.com/en-us/sql/azure-data-studio/download-azure-data-studio?view=sql-server-ver16" | hxnormalize -x | hxselect 'table a[data-linktype="external"]' | sed -r 's/(.*)(<a[^>]*>.deb<\/a>)(.*)/\2/' | sed -r 's/(.*)href="([^"]*)"(.*)/\2/')
@jaapie
jaapie / up.sh
Last active December 14, 2015 19:59
A shell function for Bash that goes up a specified number of directory levels. Easier than typing `cd ../../../` etc.
#! /bin/bash
function up () {
levels=$1
if [ -z "$levels" ]; then
levels=1
fi
# Test if $levels is a number; the -eq operator expects a number, and will
@jaapie
jaapie / rwd.css
Last active December 14, 2015 10:48 — forked from trey/rwd.css
My version of twitter-bootstrap-compatible responsive breakpoints. I couldn't get them to work properly, so I fiddled around with them until I came up with the code below.
/* http://twitter.github.com/bootstrap/scaffolding.html#responsive */
/* Landscape phones and down */
@media (max-width: 480px) {
}
/* Landscape phone to portrait tablet */
@media (max-width: 767px) and (min-width: 481px) {
}
@jaapie
jaapie / number-format-ensurinator.js
Last active August 29, 2015 14:16
Allows only number keys, enter and full stop to be entered into an input[type=number] and ensures the format is that of a floating point number
(function() {
"use strict";
var els = document.querySelectorAll('input[type=number]');
function makeKeypressEventHandler() {
return function (e) {
var keyCode = e.which || e.keyCode;
if ((keyCode >= 48 && keyCode <= 57) ||
keyCode == 13 || keyCode == 46) {