Skip to content

Instantly share code, notes, and snippets.

@carlobaldassi
carlobaldassi / XCompose_greek
Created Feb 12, 2014
Greek letters in .XCompose
View XCompose_greek
<Multi_key> <space> <a> : "α" U03B1 # GREEK SMALL LETTER ALPHA
<Multi_key> <a> <space> : "α" U03B1 # GREEK SMALL LETTER ALPHA
<Multi_key> <space> <b> : "β" U03B2 # GREEK SMALL LETTER BETA
<Multi_key> <b> <space> : "β" U03B2 # GREEK SMALL LETTER BETA
<Multi_key> <space> <c> : "ξ" U03BE # GREEK SMALL LETTER XI
<Multi_key> <c> <space> : "ξ" U03BE # GREEK SMALL LETTER XI
<Multi_key> <space> <d> : "δ" U03B4 # GREEK SMALL LETTER DELTA
<Multi_key> <d> <space> : "δ" U03B4 # GREEK SMALL LETTER DELTA
<Multi_key> <space> <e> : "ε" U03B5 # GREEK SMALL LETTER EPSILON
<Multi_key> <e> <space> : "ε" U03B5 # GREEK SMALL LETTER EPSILON
@carlobaldassi
carlobaldassi / CBModules.diff
Created Nov 15, 2019
CBModules customizations diff
View CBModules.diff
diff -r CBModules/ga/cbga.c CBModules.orig/ga/cbga.c
42c42
< #define MaxGenerations 1000
---
> #define MaxGenerations 100
154,155c154
< long watch,
< double errorscale)
---
> long watch)
@carlobaldassi
carlobaldassi / jld_alignment_issue.jl
Created Jul 24, 2018
scripts to reproduce JLD issues on julia 0.7
View jld_alignment_issue.jl
module Tst
using JLD
GC.gc()
Aarray = Vector{Float64}[[1.2,3.4],[1.1]]
str = "abc"
stringsA = ["x","y","z"]
strings16 = convert(Vector{JLD.UTF16String}, stringsA)
bigdata = [1:10000;]
@carlobaldassi
carlobaldassi / bitinitbug.jl
Last active Jan 20, 2017
Code to reproduce julia bug 20065
View bitinitbug.jl
module BitBug
function copy_to_bitarray_chunks_simplified!(Bc::Vector{UInt64}, C::Array{Bool}, numbits::Int)
ld1 = numbits - 1
u = Base._msk64
msk_d1 = (u << (ld1+1))
ind = 1
@show C
@carlobaldassi
carlobaldassi / config.log
Last active Dec 29, 2015
config.log from building GLPK 4.52
View config.log
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by GLPK configure 4.52, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ ./configure
## --------- ##
## Platform. ##
@carlobaldassi
carlobaldassi / gprangetst.jl
Created Jun 14, 2013
Quick hack to define gnuplot's-like ranges in Julia
View gprangetst.jl
module GPRangeTst
import Base: colon, show
export autoscale, parse_gpr
immutable AutoScale
end
autoscale = AutoScale()
View scalararray.jl
# systematically compare return types of scalar vs array operations
# (also div vs mod)
# prints out only mismatching cases
module ScalarArrayComp
using DataFrames
realtypes = [Bool, Uint8, Uint16, Uint32, Uint64, Uint128,
@carlobaldassi
carlobaldassi / nzipperf.jl
Last active Dec 18, 2015
Alternative Zip iterator, with better performance than the one in base, but whose performance degrades if calls to start,next,done are inlined.
View nzipperf.jl
module NZipTest
import Base.start, Base.next, Base.done, Base.length
using Benchmark
immutable NZip0
end
immutable NZip1{I1}
i1::I1
@carlobaldassi
carlobaldassi / enumperf.jl
Last active Dec 18, 2015
Faster Enumerate and Zip, benchmarks code
View enumperf.jl
# note: Enumerate2 and new_enumerate are `Enumerate` and `enumerate` in the pull request.
dosomething(x::Float64, i::Int) = x+i
function perf()
n = 1_000_000
const a = rand(n)
olden() = for (i, x) in enumerate(a) dosomething(x,i) end
function oldeninline()
@carlobaldassi
carlobaldassi / bitarray_perf_comparison.txt
Created Jun 1, 2013
BitArray performance comparisons
View bitarray_perf_comparison.txt
b = BitArray(10_000_017); fill!(b, true)
2x4 DataFrame:
Function Elapsed Relative Replications
[1,] "oldfill" 0.703632 3.394 1000
[2,] "newfill" 0.207316 1.0 1000
b1 = randbool(10_000_117); b2 = randbool(10_000_017); copy!(b1, b2)
2x4 DataFrame:
Function Elapsed Relative Replications
[1,] "oldcopy" 0.834918 2.37655 1000