Skip to content

Instantly share code, notes, and snippets.

@glumn
glumn / snippets.go
Last active October 26, 2018 08:24
Go Snippets
// Output type of a variable
// https://golang.org/pkg/fmt/#hdr-Printing
var a int
fmt.Printf("%T", a)
@glumn
glumn / gist:97f1e60958ea84a1b53ac1c6dec51daa
Last active October 27, 2018 09:12
macbook8,2 igd boot linux
menuentry 'Debian GNU/Linux, with Linux 3.1.1' {
insmod gzio
insmod part_gpt
insmod ext2
set gfxpayload=keep
# Switch gmux to IGD
outb 0x728 1
outb 0x710 2
outb 0x740 2
# Power down ATI
@glumn
glumn / eos-fresh-install.sh
Last active January 15, 2017 21:38
Linux Memo
#####################
# Install Softwares #
#####################
sudo apt-get install -y -f
# Google Chrome
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome*.deb
rm google-chrome*.deb
@glumn
glumn / scriptloader.vb
Last active August 29, 2015 14:26
Load and instantiate multiple classes as a list
Dim tAssembly = Assembly.GetExecutingAssembly()
Dim tScripts = tAssembly.GetTypes() _
.Where(Function(t) t.GetInterfaces().Contains(GetType(IScriptInterface))) _
.Select(Function(t) CType(Activator.CreateInstance(t), IScriptInterface))
@glumn
glumn / weekDatesCalculator.js
Last active August 29, 2015 14:22
Gives back the week start date and end date, provided a week number, year, and starting day (Using moment)
// http://en.wikipedia.org/wiki/ISO_8601#Week_dates
// http://stackoverflow.com/questions/662379/calculate-date-from-week-number
getDatesFromWeek: function (week, year, startOfWeekDay) {
if (startOfWeekDay == undefined || startOfWeekDay == null)
startOfWeekDay = 0; // Default StartOfWeek to Sunday if not provided
// ISO 8601 defines the week where first Thursday of the year is has Week 1
// create a variable holding the position of thursday in the week
var thursday = 4;
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
<script src="https://cdn.jsdelivr.net/mousewheel/3.1.9/jquery.mousewheel.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
<style id="jsbin-css">
header {
position: relative;
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
<script src="http://d3js.org/d3.v3.min.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
<style id="jsbin-css">
#balloon {
position: relative;