Skip to content

Instantly share code, notes, and snippets.

View linktohack's full-sized avatar

Quang-Linh LE linktohack

View GitHub Profile
@linktohack
linktohack / mod_fft.f90
Created April 19, 2013 22:13
Generate Frequency for FFT
function fftfreq(st, block)
implicit none
real*8, intent(in) :: st(:) ! sample time
integer, intent(in) :: block
real*8 :: fftfreq(size(st))
integer*4 :: n, i
real*8 :: t
@linktohack
linktohack / mod_io.f90
Created April 19, 2013 22:17
Load Text Data
subroutine load_txt_data_1d_d(d, f)
implicit none
real*8, intent(out) :: d(:) ! array of text data
character(*), intent(in) :: f ! chanel file name
open(51, file=trim(f), status='old', action='read')
read(51, *) d
close(51)
endsubroutine
@linktohack
linktohack / mod_io.f90
Created April 19, 2013 22:17
Load Binary Data
subroutine load_bin_data_1d_r(d, f)
implicit none
real*4, intent(out) :: d(:) ! array of binary data
character(*), intent(in) :: f ! chanel file name
integer*4 :: n
n = size(d)
open(51, file=trim(f), status='old', form='unformatted', &
@linktohack
linktohack / pressure.m
Created April 20, 2013 15:39
Plot chanel XX of config YY
% Plot chanel 9 of config [5 6]
loglog(freqt(1:block/2), permute(x(1:block/2,9,[5 6]), [1,3,2]));
% Plot chanel [8 9 10] of config 6
loglog(freqt(1:block/2), x(1:block/2,[8 9 10],6));
@linktohack
linktohack / pressure.m
Created April 20, 2013 15:41
numpy Hanning Window
% Hanning Windows
window = (0:block-1)'; %' Mwhaa Sublime :))
window = 0.5*(1-cos(2*pi*window/(block-1)));
@linktohack
linktohack / .vimrc
Created July 4, 2013 07:56
vim LaTeX forwad search
" LaTeXForwadSearch {{{
function! LaTeXForwadSearch()
silent! execute '!"C:\Applications\SumatraPDF\SumatraPDF.exe -reuse-instance ' \
. expand('%:p:r') . '.pdf -forward-search ' . expand('%:p') . ' ' . line('.') . '"'
" This line is reverse search for SumatraPDF
"C:\Users\Link\Dropbox\Applications\Vim\gvim.exe" --remote-silent +"%l|norm zz" "%f"
endfunction
" }}}
@linktohack
linktohack / gfortran_compiler_make.vim
Last active December 19, 2015 13:49
Vim gfortran error format
set efm=%-Ggfortran%.%#,%A%f:%l:,%A%f:%l.%c:,%A%f:%l:,%C,%C%p%*[0123456789^],%Z%trror:\ %m,,%Z%tarning:\ %m,%C%.%#,%-Gmake%.%#
@linktohack
linktohack / subr
Created January 16, 2015 10:34
Download rmate as subr (and subl if not exist)
#!/bin/bash
wget -O /usr/local/bin/subr https://raw.githubusercontent.com/aurora/rmate/master/rmate
chmod +x /usr/local/bin/subr
if ! which subl 2>&1 > /dev/null; then
ln -s /usr/local/bin/subr /usr/local/bin/subl
fi
@linktohack
linktohack / hackerWeb.js
Last active August 29, 2015 14:14
HackerWeb (bookmarklet) redirect for HackerNews frontend
javascript:(function hackerWeb (len) {
if (window.location.href.match('https://news.ycombinator.com')) {
window.location.href = window.location.href.replace('https://news.ycombinator.com/item?id=', 'http://cheeaun.github.io/hackerweb/#/item/');
} else {
var a = document.querySelectorAll('a');
if (len != a.length) {
Array.prototype.forEach.call(a, function(e) {
var href = e.getAttribute('href');
href && e.setAttribute('href', href.replace('https://news.ycombinator.com/item?id=', 'http://cheeaun.github.io/hackerweb/#/item/'));
});
@linktohack
linktohack / gender.txt
Last active August 29, 2015 14:15
Hao gender equality
Emma Watson seems nervous at first, but I can see coherence in her speech. She starts with her own experience with her family, her school then her confession of a feminist with her male friend then to a bigger picture: Human rights, where people, men an women perceive the same rights, same opportunities in their life.
As she stated in her speech, no country at the moment achieves gender equality and it doesn't seem to change much from the talk of Hilary Clinton in 1997. She also mentions that it maybe due to the fact that there was too few men who participate the campaigns.
Having a look on the map of HeForShe, I found however, the more men's votes in US and Europe, the less votes on Africa. Is this the answer why do we have Angela Merkel as Chancellor of Germany or Marissa Mayer as CEO of Yahoo! when here are many women out there doing the job no men do in Jordan or even having no ID card in Guatemala?