Skip to content

Instantly share code, notes, and snippets.

@joyhuang9473
joyhuang9473 / output_dmesg.txt
Last active August 29, 2015 14:10
custom system call
[ 239.598028] custom sys call!
[ 239.598035] process id: 1.
[ 239.598038] process name: systemd
[ 239.598040] 0xb708a000, 0xb70cb000
page frames of the interval :
[ 239.598044] pfn: 380231, pfa: 0x5cd47000
[ 239.598046] pfn: 378019, pfa: 0x5c4a3000
[ 239.598073] 0xb70cb000, 0xb70d6000 /usr/lib/libnss_files-2.18.so
page frames of the interval :
@joyhuang9473
joyhuang9473 / Makefile
Last active August 29, 2015 14:10
implement custom system call by module way
obj-m += project_mod.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
@joyhuang9473
joyhuang9473 / classify.py
Created December 26, 2014 16:26
custom classify.py in BVLC/caffe: <path_to_caffe>/python/classify.py
#!/usr/bin/env python
"""
classify.py is an out-of-the-box image classifer callable from the command line.
By default it configures and runs the Caffe reference ImageNet model.
"""
import numpy as np
import pandas as pd
import os
import sys
...
Installing pg 0.18.2 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/joy/.rubies/ruby-2.2.0/bin/ruby -r ./siteconf20150803-48365-1i2yvfa.rb extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
--with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
@joyhuang9473
joyhuang9473 / octave_plot_demo.m
Last active October 15, 2015 13:03
plot demo with Octave
% plot demo
t=[0:0.01:0.98];
y1 = sin(2*pi*4*t);
y2 = cos(2*pi*4*t);
plot(t,y1);
hold on;
plot(t,y2,'r');
xlabel('time');
ylabel('value');
legend('sin','cos');
@joyhuang9473
joyhuang9473 / downgrading_gunplot_console.log
Last active October 15, 2015 12:55
downgrading gunplot version from 5.0 to 4.6.6
$ > brew info gnuplot
gnuplot: stable 5.0.1 (bottled), HEAD
Command-driven, interactive function plotting
http://www.gnuplot.info
...
$ > brew search gnuplot
gnuplot (installed)
homebrew/versions/gnuplot4
@joyhuang9473
joyhuang9473 / octave_figure_demo.m
Last active October 15, 2015 13:04
figure demo with Octave
% figure demo
A = magic(5);
figure(1),imagesc(A);
title('figure 1');
print -dpng 'magicImagescInFigure1.png';
figure(2),imagesc(A),colormap gray;
title('figure 2');
print -dpng 'magicImagescGrayInFigure2.png';
% clean and close figure2
clf;
@joyhuang9473
joyhuang9473 / octave_imagesc_demo.m
Last active October 15, 2015 13:04
imagesc demo with Octave
% imagesc demo
A = magic(5);
imagesc(A);
title('magic imagesc');
print -dpng 'magicImagesc.png';
% imagesc with color bar
imagesc(A),colorbar;
title('magic imagesc with colorbar');
print -dpng 'magicImagescWithColorbar.png';
% imagesc with color bar, gray colormap
@joyhuang9473
joyhuang9473 / octave_subplot_demo.m
Last active October 15, 2015 13:03
subplot demo with Octave
% subplot demo
t=[0:0.01:0.98];
y1 = sin(2*pi*4*t);
y2 = cos(2*pi*4*t);
subplot(1,2,1);
plot(t,y1);
title('my subplot 1');
subplot(1,2,2);
plot(t,y2);
axis([0.5 1 -1 1]);
@joyhuang9473
joyhuang9473 / team_c++_style_guide_define_guard.h
Last active October 26, 2015 07:41
For example, the file project/Classes/Entity/Role/Role.h should have the following guard:
#ifndef ENTITY_ROLE_ROLE
#define ENTITY_ROLE_ROLE
...
#endif // ENTITY_ROLE_ROLE