Skip to content

Instantly share code, notes, and snippets.

View rnagasam's full-sized avatar

Ramana Nagasamudram rnagasam

  • Stevens Institute of Technology
  • Hoboken, NJ
View GitHub Profile
@rnagasam
rnagasam / freecad-gmsh.py
Created January 6, 2018 22:00
FreeCAD scripting -- create a mesh using GMSH from within FreeCAD
# Use GMSH from within FreeCAD
# useful for performing any
# kind of scripting with the
# FEM module
# Require : FreeCAD > 0.17
# : GMSH
# Required imports
import FreeCAD
defaults write -g InitialKeyRepeat -int 10 # normal minimum is 15 (225 ms)
defaults write -g KeyRepeat -int 1 # normal minimum is 2 ( 30 ms)
@rnagasam
rnagasam / .vimrc
Last active June 11, 2018 00:27
Minimal vimrc -- 10 lines is all you need
set nocompatible
inoremap jk <esc>
set scrolloff=999
set autochdir
set path+=**
set number
set expandtab
set wildmenu
filetype indent on
syntax enable
@rnagasam
rnagasam / .minrc
Created June 11, 2018 19:15
Yet another minimal vimrc
set nocompatible
inoremap jk <esc>
set scrolloff=999
set wildmenu
set path+=**
set number
set expandtab
set autoindent
filetype plugin indent on
syntax enable
@rnagasam
rnagasam / RoseTree.hs
Created June 11, 2018 19:59
Multiway Trees
{-# LANGUAGE InstanceSigs #-}
-- Rose Trees
data Tree a =
a :> [Tree a]
deriving (Eq, Show)
singleton :: a -> Tree a
singleton = (:> [])
@rnagasam
rnagasam / svg1.hs
Created June 13, 2018 03:40
svg-builder example
{-# LANGUAGE OverloadedStrings #-}
import Graphics.Svg
svg :: Element -> Element
svg content = doctype
<> with (svg11_ content) [Version_ <<- "1.1", Width_ <<- "300", Height_ <<- "200"]
contents :: Element
contents =
@rnagasam
rnagasam / vamosMatroid.hs
Created June 13, 2018 03:40
svg-builder example2
{-# LANGUAGE OverloadedStrings #-}
-- Translated from https://upload.wikimedia.org/wikipedia/commons/b/b7/Vamos_matroid.svg
-- For an absolutely amazing collection of Mathematical illustrations take a
-- look at https://commons.wikimedia.org/wiki/User:David_Eppstein/Gallery
import Graphics.Svg
svg :: Element -> Element
svg content =
@rnagasam
rnagasam / ghci.conf
Created June 13, 2018 03:43
GHCi configuration
:set prompt "\ESC[1;34m%s\n\ESC[0;34mλ: \ESC[m"
:def hoogle \s -> return $ ":!hoogle --count=15 \"" ++ s ++ "\""
:def doc \s -> return $ ":!haskell-docs " ++ s
:set -XOverloadedStrings
:set -XFlexibleContexts
alias ghci-core="ghci -ddump-simpl -dsuppress-idinfo \
-dsuppress-coercions -dsuppress-type-applications \
-dsuppress-uniques -dsuppress-module-prefixes"
@rnagasam
rnagasam / 20exercises.hs
Last active June 14, 2018 20:14
Solutions to Tony Morris's Haskell Exercises
{-# LANGUAGE InstanceSigs #-}
-- http://blog.tmorris.net/posts/20-intermediate-haskell-exercises/
-- Functor
class Fluffy f where
furry :: (a -> b) -> f a -> f b
instance Fluffy [] where
furry :: (a -> b) -> [a] -> [b]