Skip to content

Instantly share code, notes, and snippets.

@dehli
dehli / primes.py
Created July 1, 2015 21:33
Primes
# This function finds all the prime numbers that are less than a certain value
# getPrimes(10) would return [2, 3, 5, 7]
def getPrimes (n):
primes = []
for i in range(2, n):
isPrime = True
for primeVal in primes:
# Has a factor
if i % primeVal == 0:
@dehli
dehli / haskell
Last active May 17, 2019 18:44
A bash script that allows you to execute Haskell files more easily.
#!/bin/bash
# A script that automatically compiles and runs Haskell files
# First paramter is the Haskell file
# Temporary file location
temp=~/../../tmp
# Compile Haskell file
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<body style="background-color: transparent;">
<nav class="navbar navbar-default" id="external-nav" style="pointer-events: all">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
############################################################################
# Christian Paul Dehli
#
# This .py file demonstrates functionality that can be used to determine
# how much of a scene is visible to a robot (where certain obstacles block
# its line of sight). The functionality was needed for a game, so pinpoint
# accuracy was not required.
#
# The algorithm works by shooting rays out of the robot into the scene.
# Whenever a ray strikes an obstacle, the ray is deleted and the robot's
@dehli
dehli / profiles.clj
Created February 5, 2017 16:13
Located in ~/.lein
{:user {:plugins [[cider/cider-nrepl "0.13.0"]]
:dependencies [[org.clojure/tools.nrepl "0.2.12"]]}}
@dehli
dehli / .bashrc
Last active April 12, 2017 01:03
My Ubuntu .bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
@dehli
dehli / setup.sh
Last active October 4, 2017 14:01
#!/bin/bash
# Check if xcode command line tools are installed
if ! [ "$(xcode-select -p)" ]; then
xcode-select --install
exit 1
fi
# Install brew
if ! [ -x "$(command -v brew)" ]; then

Keybase proof

I hereby claim:

  • I am dehli on github.
  • I am dehli (https://keybase.io/dehli) on keybase.
  • I have a public key ASB3qt6zc3I_vDZ_M9w52M5hcaS3UD1ZBosKlITaiPJNGQo

To claim this, I am signing this object:

@dehli
dehli / backup.md
Last active November 28, 2017 15:46
S3 Backup
  1. Turn on versioning for the source bucket.
  2. Turn on cross-region replication and point it to a newly created backup.
  3. Copy existing s3 contents using the following command:
aws s3 sync s3://source s3://source-backup
{
"Working Directory" : "\/Users\/dehli",
"Prompt Before Closing 2" : 2,
"Selected Text Color" : {
"Green Component" : 0,
"Blue Component" : 0,
"Red Component" : 0
},
"Rows" : 25,
"Ansi 11 Color" : {