Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

raytroop

🎯
Focusing
View GitHub Profile
View rmlcks.sh
#!/bin/sh
tree -if | grep 'cdslck' > txt
var=`cat txt`
for i in $var; do
rm -i $i
done
rm -i txt
View prettyFFT.m
function [ENOB, SNDR, SFDR, SNR] = prettyFFT(wave,f_S,maxh,no_annotation,no_plot,baseline);
% Programmed by: Skyler Weaver, Ph.D.
% Date: December 7, 2010
% Version: 1.0
%
% This function plots a very pretty FFT plot and annotates all of the
% relevant data. This is intended to be used by Nyquist guys and expects
% coherently sampled data. Maybe in the future I will modify it to
% automatically detect windowed data for Delta-Sigma or allow two input
% tones. As for now, it is just for single sine-wave test, coherent data.
View conv_basic.cpp
// image convolution (3x3 conv)
int WIDTH = 1024;
int HEIGHT = 1024;
float input[(WIDTH + 2) * (HEIGHT + 2)];
float output[WIDTH * HEIGHT];
float weights[] = {1.0 / 9, 1.0 / 9, 1.0 / 9,
1.0 / 9, 1.0 / 9, 1.0 / 9,
1.0 / 9, 1.0 / 9, 1.0 / 9};
for (int j = 0; j < HEIGHT; j++)
View virtualInheritanceDemo.cpp
#include<iostream>
using namespace std;
//大小为4
class A
{
public:
int a;
};
@raytroop
raytroop / mov.cpp
Created Nov 1, 2019
copy-and-move-assignment-operators-for-a-class
View mov.cpp
#include <iostream>
using std::cout;
using std::endl;
class A {
public:
A(int x): mem_(x){}
A& operator=(const A& other) {
cout << "copy assignment operator" << endl;
mem_ = other.mem_;
@raytroop
raytroop / Singleton.cpp
Last active Dec 3, 2019
Singleton design pattern
View Singleton.cpp
class Singleton{
private:
Singleton();
Singleton(const Singleton& other);
public:
static Singleton* getInstance();
static Singleton* m_instance;
};
Singleton::Singleton() {}
@raytroop
raytroop / MatMulTiled.cu
Created Oct 23, 2019
Matrix Multiplication in CUDA using Shared memory
View MatMulTiled.cu
#include <stdio.h>
#include <stdlib.h>
#include <cuda_runtime.h>
//http://www.techdarting.com/2014/03/matrix-multiplication-in-cuda-using.html
// This code assumes that your device support block size of 1024
#define MAX_RANGE 9999
@raytroop
raytroop / pycurses.py
Created Oct 16, 2019 — forked from claymcleod/pycurses.py
Python curses example
View pycurses.py
import sys,os
import curses
def draw_menu(stdscr):
k = 0
cursor_x = 0
cursor_y = 0
# Clear and refresh the screen for a blank canvas
stdscr.clear()
@raytroop
raytroop / sbtmkdirs
Created Oct 6, 2019
Create an SBT project directory structure with a few simple options.
View sbtmkdirs
#!/bin/bash
#------------------------------------------------------------------------------
# Name: sbtmkdirs
# Version: 1.5
# Purpose: Create an SBT project directory structure with a few simple options.
# Author: Alvin Alexander, http://alvinalexander.com
# License: Creative Commons Attribution-ShareAlike 2.5 Generic
# http://creativecommons.org/licenses/by-sa/2.5/
#------------------------------------------------------------------------------
@raytroop
raytroop / 00_conditonal_compilation
Last active Sep 29, 2019
Conditional compilation
View 00_conditonal_compilation
this page intentionally left blank