Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
old="$(gsettings get org.gnome.desktop.interface text-scaling-factor)"
if (( $(echo "$old > 1.0" |bc -l) ))
then
gsettings set org.gnome.desktop.interface text-scaling-factor 1
else
gsettings set org.gnome.desktop.interface text-scaling-factor 2.2
fi
@bentles
bentles / Riddle me this
Created June 28, 2015 20:54
Data structure design challenge
On neogaf off-topic forums I encountered a fun programming challenge. Like all good riddles, the question was simple but the answer was difficult to come up with. I got two thirds of the way to the solution and then gave up and read the answer. I'm going to try and explain what I see as each version of the answer. But first, the question:
"Give a data structure that behaves like a fixed size array of size n (that is to say, O(1) to read and write any index) but additionally allows resetting all of the data to arbitrary value k in O(1)."
You can stop reading here and think about it or just skip ahead to the answer.
==============================
SPOILER WALL! DO NOT LOOK OVER
==============================
@bentles
bentles / FB Hashtags
Created March 21, 2015 07:44
An investigation into facebook hashtags
So for some reason I went on a full-scale investigation of FB hashtags last night. Here's everything I could figure out:
1) The only legal characters are small and capital letters (more on this later) and numbers.
Illegal:
#: #; ## #& #$
Derpy:
#this has spaces <-- only "this" is a hashtag
2) A hashtag cannot contain only numbers. You need at least one letter somewhere in the hashtag.