Skip to content

Instantly share code, notes, and snippets.

@ohaal
ohaal / ufw.md
Last active August 29, 2015 14:15 — forked from kimus/ufw.md

UFW

I use Ubuntu’s Uncomplicated firewall because it is available on Ubuntu and it's very simple.

Install UFW

if ufw is not installed by default be sure to install it first.

@ohaal
ohaal / +README.md
Last active September 14, 2015 13:19
Lync Push To Talk

Lync Push To Talk

Using the Lync mute/unmute hotkey (Win + F4), allows another key to be used for push to talk.

Prereqs:

Install AutoHotkey. Note - needs to be a recent version to support the splash image.
Direct link here.

Usage

@ohaal
ohaal / reverseNumber.js
Created December 7, 2015 14:06
Reverse number algorithm (123 -> 321)
function reverseNumber(input) {
var reversedNum = 0;
while (input !== 0) {
reversedNum = reversedNum * 10 + input % 10;
input = Math.floor(input / 10);
}
return reversedNum;
}
@ohaal
ohaal / README.md
Created December 14, 2015 11:15 — forked from atenni/README.md
How to permalink to a gist's raw file

Problem: When linking to the raw version of a gist, the link changes with each revision.

Solution:

To return the first file from a gist: https://gist.github.com/[gist_user]/[gist_id]/raw/

To get a file from multi–file gist: https://gist.github.com/[gist_user]/[gist_id]/raw/[file_name]

@ohaal
ohaal / numberOneByOneWithoutString.js
Created December 17, 2015 13:10
Algorithm for looping over a numbers' single digits one by one without using strings
var numberAlone;
while (number !== 0) {
numberAlone = num % 10;
number = Math.floor(number / 10);
}
@ohaal
ohaal / simpleTimestampStr.js
Last active June 16, 2016 09:06
Simple JS Timestamp String
function getTimestamp() {
return (new Date).toString().match(/\w{3} \d{1,2} \d{4} \d{1,2}:\d{2}:\d{2}/)[0];
}
@ohaal
ohaal / column-toggle-and-size-for-jira-rapid-boards.js
Last active June 13, 2017 11:51 — forked from hestenet/column-toggle-and-size-for-jira-rapid-boards.js
A javascript hack for JIRA that allows resizing of RapidBoard columns and toggling their display on/off - just add to your Announcement Banner
/////////////////////
//
// DO NOT DELETE ME!
// Please take care when editing the announcement banner - it contains custom Javascript/CSS to improve Jira's UI.
//
/////////////////////
/////////////////////
// Inspired by
// https://jira.atlassian.com/browse/GHS-3690?focusedCommentId=693585&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-693585
@ohaal
ohaal / queryToHtml.php
Created May 24, 2016 20:33
Simple MySQL query to HTML
function queryToHtml($mysqli, $query) {
if ($result = $mysqli->query($query)) {
/* Get field information for all columns */
$finfo = $result->fetch_fields();
// Print headers
print('<table><tr>');
foreach ($finfo as $val) {
printf('<th>%s</th>', $val->name);
@ohaal
ohaal / oracle_locks.sql
Created June 13, 2016 08:03
Oracle SQL locks
-- source: http://psoug.org/snippet/LOCKS-View-Locked-Objects_866.htm
-- view all currently locked objects:
SELECT username U_NAME, owner OBJ_OWNER,
object_name, object_type, s.osuser,
DECODE(l.block,
0, 'Not Blocking',
1, 'Blocking',
2, 'Global') STATUS,
DECODE(v.locked_mode,
@ohaal
ohaal / countdown-string.js
Last active June 16, 2016 09:06
generate countdown string to a timestamp
var cdStamp = 1472301000000;
var cdDuration = cdStamp - (new Date().getTime());
cdDuration = cdDuration > 0 ? cdDuration : 0;
var cdTimes = [ 7, 24, 60, 60, 1000];
var cdUnit = ['uke', 'dag', 'time', 'minutt', 'sekund'];
var cdUnitEnd = [ 'r', 'er', 'r', 'er', 'er'];
var cdResult = cdTimes
.map((t, i, timeArr) => {
var unitMulti = timeArr.slice(i, timeArr.length).reduce((a,b) => a*b);