Skip to content

Instantly share code, notes, and snippets.

View tmwatchanan's full-sized avatar
⌨️
I use Neovim btw

Watchanan Chantapakul tmwatchanan

⌨️
I use Neovim btw
View GitHub Profile
@tmwatchanan
tmwatchanan / rounded_off_matrix.m
Created June 4, 2016 14:32
MATLAB script – any members in array A that greater than 5 will be changed into 5
A = [2 5 7 0 3 2 1 8 9]
for k = 1:length(A)
if A(k) <= 5
B(k) = A(k); % insert ; to disable internal message of this step
else
B(k) = 5; % insert ; to disable internal message of this step
end
end
@tmwatchanan
tmwatchanan / audio_player.m
Created June 4, 2016 14:47
Audio MATLAB scripting – recording with microphone, and audio player for the recorded audio data
p = audioplayer(s, 1.5*Fs);
p.play();
% t = (0:(length(s)-1))/Fs; % Ts = 1/Fs
% figure; plot(t,s)
figure; plot(s);
@tmwatchanan
tmwatchanan / realtime_plot_audio.m
Created June 4, 2016 14:55
Realtime audio spectrum MATLAB script – แสดงผล spectrum ของเสียงที่ถูกอัดผ่าน microphone แบบ realtime
Fs = 1e4;
Duration = 0.5;
r = audiorecorder(Fs,16,1);
figure;
while 1
recordblocking(r, Duration);
s = double(getaudiodata(r));
Sf = fft(s, Fs);
Sf = abs(Sf);
t = [0:(length(s) - 1)] / Fs;
@tmwatchanan
tmwatchanan / object_detection.m
Created June 10, 2016 08:27
Object Detection MATLAB script
% Read the reference image containing the object of interest.
boxImage = imread('stapleRemover.jpg');
% figure; imshow(boxImage);
title('Image of a Box');
% Read the target image containing a cluttered scene.
sceneImage = imread('clutteredDesk.jpg');
% figure; imshow(sceneImage);
title('Image of a Cluttered Scene');
@tmwatchanan
tmwatchanan / check-classes.cs
Created November 10, 2016 17:37
Checking properties of classes
public partial class EMPLOYEE
{
public short EMPID { get; set; }
public string JOBPOSITION { get; set; }
public int SALARY { get; set; }
public string CITIZENID { get; set; }
public virtual PERSON PERSON { get; set; }
}
@tmwatchanan
tmwatchanan / tnsnames.ora
Created November 11, 2016 10:15
[Oracle] data connections
XE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = DESKTOP-C2QMD8S)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
)
)
EXTPROC_CONNECTION_DATA =
@tmwatchanan
tmwatchanan / keybase.md
Created November 21, 2017 10:44
Keybase - Prove GitHub Identity

Keybase proof

I hereby claim:

  • I am tmwatchanan on github.
  • I am watchanan (https://keybase.io/watchanan) on keybase.
  • I have a public key whose fingerprint is 3643 BF08 42DB 5593 1EF4 AA51 238D 88F0 7529 062D

To claim this, I am signing this object:

@tmwatchanan
tmwatchanan / vimium-options.json
Last active July 4, 2019 16:33
My Vimium (FireFox add-on or Google Chrome extension) settings (https://github.com/philc/vimium)
{
"settingsVersion": "1.64.6",
"exclusionRules": [
{
"pattern": "^https?://mail.google.com/",
"passKeys": ""
},
{
"pattern": "https://cloud.digitalocean.com/droplets/",
"passKeys": ""
@tmwatchanan
tmwatchanan / .bashrc
Created September 16, 2018 03:08
Watchanan's Bash Run Commands for WSL
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# Xserver with VcXsvr
export DISPLAY=localhost:0
# Xserver with Xming
#export DISPLAY=:0
# VS Code
@tmwatchanan
tmwatchanan / .vimrc
Created September 17, 2018 06:25
Vundle .vimrc configuration
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required