This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Works on Elixir 1.0.x | |
# Usage: just pust to `iex` shell, or run `elixir conway.ex` | |
defmodule Sum do | |
defstruct value: 0 | |
def value(%Sum{value: value}), do: value | |
def add(%Sum{value: value} = sum, x) do | |
%Sum{sum | value: value + x} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Set brightness via radeon_bl0 when redshift status changes (amdgpu,radeon) | |
### Set brihtness via xbrightness when redshift status changes | |
# Set brightness values for each status. | |
# Range from 1 to 255 is valid | |
brightness_day="255" | |
brightness_transition="120" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NEWROOT=`dirname $(readlink -f $0)` | |
read -n1 -p "chroot to $NEWROOT? (y/n) :" ack | |
[ foo"$ack" == fooy ] || exit -1 | |
echo " " | |
function mount_if_not() { | |
dir=$1 | |
mount | grep $NEWROOT$dir >/dev/null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Time-stamp: <2017-04-21 17:44:04 kmodi> | |
# https://discuss.gohugo.io/t/auto-generate-file-name-based-on-title/4648/2?u=kaushalmodi | |
# This script uses the unofficial strict mode as explained in | |
# http://redsymbol.net/articles/unofficial-bash-strict-mode | |
# | |
# Also checks have been done with www.shellcheck.net to have a level of | |
# confidence that this script will be free of loopholes.. or is it? :) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Time-stamp: <2017-05-18 08:18:01 kmodi> | |
# Usage: ./mybuild.sh # Installs using origin/devel | |
# ./mybuild.sh --rev v0.17.0 | |
# ./mybuild.sh --rev origin/master | |
set -euo pipefail # http://redsymbol.net/articles/unofficial-bash-strict-mode | |
IFS=$'\n\t' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Time-stamp: <2018-05-11 15:59:07 kmodi> | |
# Script to stow packages from ${STOW_PKGS_ROOT} to ~/stowed | |
# Usage: stow_it.sh (That's it; from any directory) | |
# This script uses the unofficial strict mode as explained in | |
# http://redsymbol.net/articles/unofficial-bash-strict-mode | |
# Also checks have been done with www.shellcheck.net to have a level of |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
digraph G { | |
ranksep=1.0; | |
ratio=0.6; | |
LISP [color=Blue, shape=box, label="LISPs"]; | |
ALGOL [color=Blue, shape=box, label="ALGOL-like\nLanguages"]; | |
Modula [color=Blue, shape=box, label="Wirth's\nPascal-likes"]; | |
Smalltalk [color=Blue, shape=box, label="Smalltalk-like\nLanguages"]; | |
FP [color=Blue, shape=box, label="Functional\nProgramming\nLanguages"]; | |
P [label="Prototype-based\nLanguages", color=Blue, shape=box]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket/base | |
(require 2htdp/universe 2htdp/image lang/posn) | |
; The gravitational constant G | |
(define G 6.67428e-11) | |
; Assumed scale: 100 pixels = 1AU | |
(define AU (* 149.6e6 1000)) | |
(define SCALE (/ 250 AU)) | |
(struct body (id px py vx vy mass radius color) #:mutable #:transparent) ;Structure of body |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
''' | |
fourdown.py | |
A simple script to grab links to images found on a page. | |
You can use as is for downloading images from thread on 4chan or you can | |
import FourDown and do what ever you want with it. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c | |
index 2a75365..b466ab2 100644 | |
--- a/gtk/gtkfilechooserdefault.c | |
+++ b/gtk/gtkfilechooserdefault.c | |
@@ -81,6 +81,7 @@ | |
#include <sys/stat.h> | |
#include <sys/types.h> | |
#include <locale.h> | |
+#include <math.h> | |