This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://theramblingness.com | |
#include <stdio.h> | |
#include <stdint.h> | |
#define Qn 31 | |
int main() | |
{ | |
// Variables | |
uint32_t scaler = (uint32_t)(1<<Qn); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
op1 = (int32_t)(f_op1*(double)scaler); // op1 in Qn format | |
op2 = (int32_t)(f_op2*(double)scaler); // op2 in Qn format | |
// Convert the dividend to Q(2*n) format | |
tmp = ((uint64_t)op1 << Qn); | |
// Round by summing half the divisor | |
tmp += op2 >> 1; | |
// Division | |
tmp /= (uint64_t)(op2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://theramblingness.com | |
#include <stdio.h> | |
#include <stdint.h> | |
#define Qn 15 // Q-format | |
// These types should be defined according to CPU bitness | |
#define FXPLONG int64_t | |
#define FXPSHORT int32_t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clear all | |
close all | |
clc | |
pkg load signal; | |
Ns = 4096; | |
t_max = 0.1; | |
Ts = t_max / 4096; | |
Fs = 1/Ts; | |
t = linspace(0, t_max, Ns); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdint.h> | |
#include <time.h> | |
int main() | |
{ | |
puts("Lets go"); | |
time_t t; | |
int elapsed_time = time(&t); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uint32_t i = 999999999; | |
uint32_t j = 1; | |
for( ; i > 0 ; i--) j = i; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uint32_t i = 999999999; | |
uint32_t j = 1; | |
for( ; i > 0 ; i--) j += i; | |
printf("j final value: %u\n", j); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DOCKERFILE=Dockerfile.dev | |
build_image() { | |
# Uncomment if you don't want to build an image if it already exists | |
#if [ ! "$(docker image ls | grep $1)" ]; then | |
echo "Build" | |
docker build . -t $1 -f $DOCKERFILE | |
#fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add this to your .zshrc file (or equivalent) | |
# Kills all processes running on a given port | |
# Usage: killport <port> | |
function killport() { | |
lsof -i:$1 | grep LISTEN | awk '{print $2}' | xargs kill -9 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Usage: heroku_dotenv.sh <heroku_app_name> <dotenv_file> | |
# Default dotenv_file: .env | |
dotenv=${2-".env"} | |
heroku config -a $1 | | |
sed -n '1!p' | | |
awk '{ gsub(/:/,"", $1); f=$1; $1=""; print f"="substr($0,2) }' > $dotenv | |
cat $dotenv | |
echo "File written: $dotenv" |
OlderNewer