Skip to content

Instantly share code, notes, and snippets.

View JayKickliter's full-sized avatar
💭
Cache Rules Everything Around Me

Jay Kickliter JayKickliter

💭
Cache Rules Everything Around Me
View GitHub Profile
@JayKickliter
JayKickliter / RemoveWordsFromString
Created August 10, 2013 15:46
C# function to removed words at it specified indices in a string. No protection for out of bound indices.
static string RemoveWordsAtIndices(string theString, int[] indices)
{
Array.Sort(indices);
int originalWordCount;
int newWordCount;
int numberOfWordsToRemove;
string[] originalWordArray;
string[] newWordArray;
originalWordArray = theString.Trim().Split(' ');
@JayKickliter
JayKickliter / Julia FFTS.jl
Last active August 29, 2015 13:57
Calling FFTS c functions from Julia
# Complex transforms
# Sign argument
# -1 = Complex to Complex reverse FFT
# 1 = Complex to Complex forward FFT
# ffts_plan_t *ffts_init_1d(size_t N, int sign);
# Create a plan for a forward 1D FFT of size 16
N = 2^16
Direction = 1
ffts_plan = ccall((:ffts_init_1d, "libffts"), Ptr{Void}, (Csize_t, Cint), N, Direction)
#==============================================================================#
# Kaiser Filter #
#==============================================================================#
fc = 0.15 # filter cutoff frequency
ft = 0.05 # filter transition
As = 60.0 # stop-band attenuation [dB]
mu = 0.0 # fractional timing offset
# estimate required filter length and generate filter
using Radio
using Winston
import DSP: welch_pgram
symbols = pskmod( 100000, 4, 4 )
noise = wgn(length(symbols), 5, "dBm", 50, true)
signal = symbols .+ noise
spectrum = welch_pgram( signal, 100, 50 )
spectrum = fftshift( spectrum )
spectrum = 10*log10( spectrum )
# function czt( x::Vector )
x = ones(8)
N = length( x )
M = nextpow2( 2*N - 1 )
xx = zeros( Complex128, M )
yy = zeros( Complex128, M )
for n = 1:N
xx[n] = x[n]
yy[n] = exp( im * π/N * (n-1)^2 )
@JayKickliter
JayKickliter / ValidateIPAddress
Created April 21, 2014 00:48
Android: Validate IP Address
String ipAddressPattern = Patterns.IP_ADDRESS.toString();
if (theAddress.matches( ipAddressPattern )) {
ippLibPath = "/opt/intel/composer_xe_2013_sp1.3.166/ipp/lib"
originalFolder = pwd()
cd( ippLibPath )
function fix_ipp_dylib( dylibFileName, path )
correct_id = joinpath( ippLibPath, dylibFileName ) # we want all the dylib ID's to have the full path
cmd_get_id = `otool -DX $dylibFileName` # Get the dylib's ID (we want it to be path+filename)
cmd_set_id = `install_name_tool -id $correct_id $dylibFileName`
results = readlines( cmd_get_id )
original_id = strip( results[1] ) # The first line is a header, the second is the dylib's ID
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import IPPDSP
function polyize{T}( h::Vector{T}, interpolation )
hLen = length( h )
tapsPerPhase = int( ceil( hLen/interpolation ))
pfbSize = tapsPerPhase * interpolation
# check that the vector is an integer multiple of interpolation
if hLen != pfbSize
hExtended = similar( h, pfbSize )
hExtended[1:hLen] = h