Skip to content

Instantly share code, notes, and snippets.

View ararslan's full-sized avatar

Alex Arslan ararslan

  • Beacon Biosignals
  • Seattle, WA
  • 21:28 (UTC -07:00)
View GitHub Profile
@davidanthoff
davidanthoff / packagedb.jl
Created October 18, 2016 23:49
PkgQuery
immutable Require
name::String
lower_bound::Nullable{VersionNumber}
upper_bound::Nullable{VersionNumber}
platform::Nullable{String}
end
immutable Version
version::VersionNumber
sha1::String
@simonbyrne
simonbyrne / IBMFloat64.jl
Created April 23, 2013 14:07
converts 64bit IBM floating point numbers to IEEE754 64bit floats
import Base.convert
bitstype 64 IBMFloat64
# ibm float format is hex based:
# * bit 1 = sign
# * bits 2-8 = exponent to the power of 16, with bias of 64
# * bits 9-64 = mantissa: no implied leading 1 (unlike ieee),
# typically normalised (hex of bits 9-12 is non-zero), though this need
# not be the case
#supson.jl
type ツ; end
_(::Type{ツ}) = ツ
*(::Type{ツ}, ::Function) = ツ
type ⎺; end
Base.:\(::Type{⎺},::Type{ツ}) = ツ
Base.:/(::Type{ツ},::Type{⎺}) = true
⎺\_(ツ)_/⎺ #==> true

Univariate API

A new univariate distribution type should implement all of the following methods:

  • Core constructors
    • MyDistribution{T}(args[...])
    • We need to clarify whether constructors should handle input validation or not. There are use cases in which people want to avoid input validation.
  • params(d::MyDistribution{T})::Tuple: A tuple of the distribution's parameters in our canonical order.
  • minimum(d::MyDistribution{T})::T: The lowest value in the support of MyDistribution.
  • maximum(d::MyDistribution{T})::T: The highest value in the support of MyDistribution.
#!/bin/bash
# Helper to jump to julia package source
function jlj()
{
if [[ $# != 1 ]]; then
echo "Usage: jlj <package name>" >&2
return
fi
using Cassette, Test
using Cassette: @context, enabletagging, @overdub, overdub, recurse,
hasmetadata, metadata, tag, untag
using ChainRules: frule, Zero, extern
@context DiffCtx
Cassette.metadatatype(::Type{<:DiffCtx}, ::Type{T}) where {T<:Real} = T
function D(f, x)
@prash-wghats
prash-wghats / Readme_VSCODE_FreeBSD
Last active June 4, 2021 08:21
Notes for Building Electron and VSCode in FreeBSD11
Copy all the files to the build directory.
Copy icudtl.dat to the build directory. (you can find it in the vscode downloads ex for linux).
chromium version in port is 52.0.2743.116.
This was built with FreeBSD 11.0-RELEASE-p1. If building with other versions probably need to change
the freebsd versions in diff files (ex. freebsd11 => freebsd10)
Installed
node => v6.9.1
npm => 3.9.2
>chmod 755 vscode_build.sh
" deoplete.vim contains vim settings relevant to the deoplete autocompletion
" plugin
" for more details about my neovim setup see:
" http://afnan.io/2018-04-12/my-neovim-development-setup/
" deoplete options
let g:deoplete#enable_at_startup = 1
let g:deoplete#enable_smart_case = 1
" disable autocomplete by default
@ssp
ssp / git-extract-file.markdown
Created January 23, 2012 13:21
Extract a single file from a git repository

How to extract a single file with its history from a git repository

These steps show two less common interactions with git to extract a single file which is inside a subfolder from a git repository. These steps essentially reduce the repository to just the desired files and should performed on a copy of the original repository (1.).

First the repository is reduced to just the subfolder containing the files in question using git filter-branch --subdirectory-filter (2.) which is a useful step by itself if just a subfolder needs to be extracted. This step moves the desired files to the top level of the repository.

Finally all remaining files are listed using git ls, the files to keep are removed from that using grep -v and the resulting list is passed to git rm which is invoked by git filter-branch --index-filter (3.). A bit convoluted but it does the trick.

1. copy the repository to extract the file from and go to the desired branch

@ofan
ofan / lisp.cpp
Last active April 11, 2024 11:28
Lisp interpreter in 90 lines of C++
Lisp interpreter in 90 lines of C++
I've enjoyed reading Peter Norvig's recent articles on Lisp. He implements a Scheme interpreter in 90 lines of Python in the first, and develops it further in the second.
Just for fun I wondered if I could write one in C++. My goals would be
1. A Lisp interpreter that would complete Peter's Lis.py test cases correctly...
2. ...in no more than 90 lines of C++.
Although I've been thinking about this for a few weeks, as I write this I have not written a line of the code. I'm pretty sure I will achieve 1, and 2 will be... a piece of cake!