Skip to content

Instantly share code, notes, and snippets.

View ideaflare's full-sized avatar

Christoph ideaflare

View GitHub Profile
@ideaflare
ideaflare / bash_profile
Created October 13, 2018 19:20
MacOS ~/.bash_profile
PS1="\A\w $ "
alias code='/Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code'
@ideaflare
ideaflare / unsplash-background.sh
Last active November 23, 2024 22:39
Update background to random unsplash image (Ubuntu /w Gnome Desktop)
readonly THEME='sky'
readonly PIC_PATH='/home/'"$USER"'/Pictures/Unsplash/'
readonly PIC_FILE=''"$PIC_PATH"'today.jpeg'
setupDirectory() {
mkdir -p $PIC_PATH
}
downloadToday() {
local RES=$(xdpyinfo | awk '/dimensions/{print $2}')
@ideaflare
ideaflare / post-setup.sh
Last active May 24, 2018 16:30
Customization for Ubuntu 18.04 minimal
## auto-upgrades
sudo apt install unattended-upgrades
# remove trash icon from desktop & add tweak ui (i.e. activities overview hot corner)
gsettings set org.gnome.nautilus.desktop trash-icon-visible false
#sudo apt-get install gnome-tweak-tool
## red shift
gsettings set org.gnome.settings-daemon.plugins.color night-light-enabled true
@ideaflare
ideaflare / .bashrc
Created September 2, 2017 19:34
Useful bashrc additions
# Delete
slice() {
if [ $# -eq 0 ]
then
echo "No arguments supplied"
else
read -p "Sure you want to : shred -vzu $1? " -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
@ideaflare
ideaflare / CustomElementWithStyle.html
Created July 21, 2017 21:01
Create custom element and style it.
<!DOCTYPE html>
<html>
<body>
<div id="container" style="padding: 20px; border: 1px dashed grey;">
<div>Don't replace this.</div>
<custom-button></custom-button>
<div>Don't replace this either.</div>
</div>
@ideaflare
ideaflare / introrx.md
Created July 11, 2017 17:55 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@ideaflare
ideaflare / ArgumentCheck.html
Last active June 30, 2017 17:38
Check that all arguments are present: function unspecified(args) {..}
<!DOCTYPE html>
<html>
<body>
<p>Finding the sum of numbers.</p>
<p>Sum() returns <span id="demo-no-arguments"></span></p>
<p>Sum(32) returns <span id="demo-32"></span></p>
<p>Sum(1,2,3,4,5) returns <span id="demo-1-to-5"></span></p>
<script>
type Color = Red | Green | Ivory | Yellow | Blue
type Nation = England | Spain | Ukrane | Norway | Japan
type Pet = Dog | Snail | Fox | Horse | Zebra
type Drink = Coffee | Tea | Milk | Juice | Water
type Smoke = OldGold | Kools | Chester | Lucky | Parliaments
// who drinks water? who owns the zebra ?
type House = {color: Color; nation: Nation; pet: Pet; drink: Drink; smoke: Smoke}
// Add NuGet package FSharp.Data
#r "../packages/FSharp.Data.2.3.2/lib/net40/FSharp.Data.dll" //#r is needed in .fsx file. You can omit this line in .fs file.
open FSharp.Data
let apiUrl = "http://swapi.co/api/people/?format=json"
type People = JsonProvider<"http://swapi.co/api/people/?format=json">
type Planet = JsonProvider<"http://swapi.co/api/planets/1/"> // * planet was found by inspecting....
// assumption made, all planets have the same json structure/properties as planet #1