Skip to content

Instantly share code, notes, and snippets.

View alexlouden's full-sized avatar
🐶
👋

Alex Louden alexlouden

🐶
👋
View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
rm -rf build
mkdir build
cd build
cmake \
-G "Unix Makefiles" \
-D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D CUDA_FAST_MATH=1 \
-D WITH_CUBLAS=1 \
@alexlouden
alexlouden / CMakeLists.txt
Created July 13, 2016 02:45
Good features to track
cmake_minimum_required(VERSION 3.5)
project(Test)
set(the_target "Test")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
# CUDA
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake/cuda" ${CMAKE_MODULE_PATH})
FIND_PACKAGE(CUDA)
LIST(APPEND CUDA_NVCC_FLAGS "-arch=compute_30")
@alexlouden
alexlouden / form_prefix.py
Last active May 9, 2016 03:00
Django prefixed form with data
from django import forms
class PersonForm(forms.Form):
name = forms.CharField(required=True)
## Initial data = valid
f = PersonForm({'name': 'Alex'})
f.is_valid()
@alexlouden
alexlouden / terraform_diffs.log
Created May 28, 2015 05:17
aws_security_group - diffs didn't match during apply
aws_security_group.worker
2015/05/28 11:48:42 [TRACE] Graph after step *terraform.RootTransformer:
aws_security_group.worker
2015/05/28 11:48:42 [DEBUG] vertex root.mymodule.aws_security_group.worker: walking
* DependencyViolation: resource sg-api has a dependent object
2015/05/28 11:48:42 [DEBUG] vertex root.mymodule.aws_security_group.worker: evaluating
2015/05/28 11:48:42 [DEBUG] root.mymodule: eval: *terraform.EvalSequence
2015/05/28 11:48:42 [DEBUG] root.mymodule: eval: terraform.EvalNoop
@alexlouden
alexlouden / replace_outline.sass
Created May 20, 2015 14:30
Replace Chrome link outline with box-shadow
// Replace outline with box-shadow
// because it was wrapping around after psudo element border
outline: 0
// white rectangle inside grey rectangle
// 2px offset down to center
// 1px blur
box-shadow: 0 2px 1px 3px white, 0 2px 1px 6px rgba(119, 119, 119, 0.4)
@alexlouden
alexlouden / scrollbar.sass
Created March 25, 2015 13:02
Subtle scrollbar
::-webkit-scrollbar
width: 10px
height: 10px
::-webkit-scrollbar-thumb
background-color: rgba(50,50,50,.25)
border: 2px solid transparent
border-radius: 10px
background-clip: padding-box
@alexlouden
alexlouden / rifleman.py
Created February 11, 2015 10:34
Rifleman's Creed - gensim Phrases
from gensim.models import Phrases
from nltk.tokenize import word_tokenize
creed = """This is my rifle. There are many like it, but this one is mine.
My rifle is my best friend. It is my life. I must master it as I must master my life.
My rifle, without me, is useless. Without my rifle, I am useless. I must fire my rifle true. I must shoot straighter than my enemy who is trying to kill me. I must shoot him before he shoots me. I will...
My rifle and I know that what counts in war is not the rounds we fire, the noise of our burst, nor the smoke we make. We know that it is the hits that count. We will hit...
My rifle is human, even as I, because it is my life. Thus, I will learn it as a brother. I will learn its weaknesses, its strength, its parts, its accessories, its sights and its barrel. I will keep my rifle clean and ready, even as I am clean and ready. We will become part of each other. We will...
Before God, I swear this creed. My rifle and I are the defenders of my country. We are the masters of our ene
(function($) {
$.fn.textfill = function(maxFontSize) {
maxFontSize = parseInt(maxFontSize, 10);
return this.each(function(){
var ourText = $("span", this),
parent = ourText.parent(),
maxHeight = parent.height(),
maxWidth = parent.width(),
fontSize = parseInt(ourText.css("fontSize"), 10),
multiplier = maxWidth/ourText.width(),
@alexlouden
alexlouden / svg_get_path_length.js
Created April 5, 2014 09:53
Use D3 to determine SVG path length
d3.select('#path4').node().getTotalLength()