Instantly share code, notes, and snippets.

View color-conversion-algorithms.js
/**
* Converts an RGB color value to HSL. Conversion formula
* adapted from http://en.wikipedia.org/wiki/HSL_color_space.
* Assumes r, g, and b are contained in the set [0, 255] and
* returns h, s, and l in the set [0, 1].
*
* @param Number r The red color value
* @param Number g The green color value
* @param Number b The blue color value
* @return Array The HSL representation
View 50_recovery_iso
#!/bin/sh
exec tail -n +3 $0
menuentry "Ubuntu recovery ISO" {
set isofile="/recovery/ubuntu.iso"
loopback loop (hd0,gpt2)$isofile
linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile noprompt noeject
initrd (loop)/casper/initrd.lz
}
View bbswitch.conf
options bbswitch load_state=0 unload_state=1
View 40-max-user-watches.conf
# /etc/sysctl.d/40-max-user-watches.conf
fs.inotify.max_user_watches=524288
View .fonts.conf
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<!-- See: man 5 fonts-conf -->
<!-- Antialias rules -->
<match target="font">
<!--
Subpixel smoothing: rgb, bgr, vrgb, vbgr, none
Most monitors manufactured today use the Red, Green, Blue (RGB) specification.
View 60-scheduler.rules
# /etc/udev/rules.d/60-scheduler.rules
#
# set none scheduler for non-rotating disks
ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="none"
# set bfq scheduler for rotating disks
ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="1", ATTR{queue/scheduler}="bfq"
View vsc launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Django",
"type": "python",
"request": "launch",
"stopOnEntry": false,
"pythonPath": "env/bin/python",
"program": "${workspaceRoot}/manage.py",
View gist:5af47f6fd496695e1d3deb8232225e86
[radu@blue ~]$ iperf3 -c c1
Connecting to host c1, port 5201
[ 4] local 192.168.1.3 port 45912 connected to 192.168.1.2 port 5201
[ ID] Interval Transfer Bandwidth Retr Cwnd
[ 4] 0.00-1.00 sec 35.0 MBytes 294 Mbits/sec 0 850 KBytes
[ 4] 1.00-2.00 sec 38.8 MBytes 325 Mbits/sec 0 1.02 MBytes
[ 4] 2.00-3.00 sec 36.2 MBytes 304 Mbits/sec 0 1.07 MBytes
[ 4] 3.00-4.00 sec 40.0 MBytes 336 Mbits/sec 0 1.07 MBytes
[ 4] 4.00-5.00 sec 36.2 MBytes 304 Mbits/sec 0 1.13 MBytes
[ 4] 5.00-6.00 sec 38.8 MBytes 325 Mbits/sec 0 1.21 MBytes
View test.py
import sys
sys.path.append("../")
import inp
from hsort import *
import unittest
class TestCase(unittest.TestCase):
def setUp(self):