Skip to content

Instantly share code, notes, and snippets.

@yichao0319
yichao0319 / Cubic-solver.cpp
Created April 28, 2012 20:19 — forked from spinachgui/Cubic-solver.cpp
C: gaussian elimination
//Phaw! This certainly needs cleaning up, but it does work.
#include <complex>
#include <iostream>
#include <cmath>
using namespace std;
typedef long double R;
typedef complex<double> cplex;
@yichao0319
yichao0319 / slice.m
Created July 13, 2012 18:31
matlab:slice
function [ out_sym, table ] = slice( in_sym, mod_type )
%SLICE Makes hard decision on input symbols with designated modulation type
%
% Inputs:
% in_sym: input symbols to be sliced
% mod_type: modulation type, BPSK, QPSK, 16QAM, or 64QAM
%
% Outputs:
% out_sym: output symbols
% table: mapping alphabet
@yichao0319
yichao0319 / feed43:ck101
Last active September 28, 2016 03:14
feed43:卡提諾
<li class="cartoon-img">{*}<a href="{%}" title="{%}">{*}<img src="{%}" title="{*}" alt="{*}" src="{*}" alt="Bad Image" onError="this.src='{*}';"/>{*}</a>{*}<h6><a target="_blank" href="{*}" title="{*}"><strong>{*}</strong></a></h6>{*}<p>{*}<em>{*}</em></p>{*}</li>
@yichao0319
yichao0319 / perl:open dir
Created September 27, 2013 21:50
perl:open dir
opendir(DIR, $dir) or die $!;
while (my $file = readdir(DIR)) {
next if($file =~ /^\.+/); ## don't show "." and ".."
next if(-d "$dir/$file"); ## don't show directories
print "$file\n";
}
closedir(DIR);
@yichao0319
yichao0319 / perl:new code
Last active February 15, 2018 17:23
perl:new code
#!/bin/perl
##########################################
## Author: Yi-Chao Chen @ Hauoli
##
## - input:
##
## - output:
##
## - e.g.
@yichao0319
yichao0319 / perl:datetime
Created October 8, 2013 05:00
perl:datetime
use DateTime::Format::Strptime;
my $parser = DateTime::Format::Strptime->new(
pattern => '%B %d %H-%M-%S %Y',
on_error => 'croak',
);
my $dt = $parser->parse_datetime($file);
print $dt->year()."/".$dt->month()."/".$dt->day()." ".$dt->hour().":".$dt->minute().":".$dt->second()."\n";
@yichao0319
yichao0319 / matlab:new code
Last active December 25, 2015 00:19
matlab:new code
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Yi-Chao Chen @ UT Austin
%%
%% - Input:
%%
%%
%% - Output:
%%
%%
%% example:
@yichao0319
yichao0319 / gnuplot:linespoints
Last active August 29, 2016 04:04
gnuplot:linespoints
reset
set terminal postscript eps enhanced color 28 dl 4.0
# set terminal png enhanced 28 size 800,600
# set terminal jpeg enhanced font helvetica 28
set size ratio 0.7
data_dir = "./DATA_DIR/"
fig_dir = "./FIG_DIR/"
file_name = "FILE_NAME"
fig_name = "FIG_NAME"
@yichao0319
yichao0319 / perl:gnuplot mother
Created October 14, 2013 23:42
perl:gnuplot mother
my $cmd = "sed 's/DATA_DIR/xxx/g; s/FIG_DIR/xxx/g; s/FILE_NAME/xxx/g; s/FIG_NAME/xxx/g; s/DEGREE/xxx/g; s/X_LABEL/xxx/g; s/Y_LABEL/xxx/g; s/X_RANGE_S/xxx/g; s/X_RANGE_E/xxx/g; s/Y_RANGE_S/xxx/g; s/Y_RANGE_E/xxx/g; s/TITLE_1/xxx/g; s/TITLE_2/xxx/g;' xxx.mother > tmp.xxx";
`$cmd`;
$cmd = "gnuplot tmp.xxx";
`$cmd`;
@yichao0319
yichao0319 / bash:ls dir
Created October 28, 2013 23:43
bash:ls dir
input_dir="/u/yichao/dir"
cnt=1
ls ${input_dir} | while read f ; do
echo "${cnt}: ${input_dir}$f"
let cnt=${cnt}+1
done