Skip to content

Instantly share code, notes, and snippets.

View xcv58's full-sized avatar
😀
What's happening?

xcv58 xcv58

😀
What's happening?
View GitHub Profile
@xcv58
xcv58 / vim tips
Last active December 25, 2015 16:49
Vim tips. For details I found in daily use.
set fileencoding=utf-8
"this line causes the long long latency for opening lagre file.
"set fileencodings=utf-8,ucs-bom,cp936,gb18030,utf-16,big5,gbk,ucs-bom,cp936,latin1
"for vim-latex
"only for tex files. three <leader> to write and compile. view is reserved.
autocmd FileType tex map <leader><leader><leader> :w<cr><plug>Tex_Compile
"<plug>Tex_View
"C-L to automatically add \left and \right. Because <Alt+L> will key in special symbol.
@xcv58
xcv58 / fix_run_cell.el
Created November 18, 2013 20:24
Matlab-Emacs. Fixed matlab-shell-run-cell ()
(defun matlab-shell-run-cell ()
"Run the cell the cursor is in."
(interactive)
(let ((start (save-excursion (end-of-line);(forward-page -1)
(re-search-backward "\\(%%\\)\\|\\`")
(if (looking-at "function")
(error "You are not in a cell. Try `matlab-shell-save-and-go' instead"))
(point)))
(end (save-excursion (end-of-line)
(re-search-forward "\\(%%\\)\\|\\'")
@xcv58
xcv58 / OS_161_Mac_OS_Tutorial.txt
Last active January 5, 2017 01:40
The method for setting OS/161 environment for Mac OS X
I just test on OS X 10.9.1
You need homebrew first: http://brew.sh
Then:
brew tap homebrew/versions
brew install gcc48
Long wait.
@xcv58
xcv58 / gist:8773106
Last active August 29, 2015 13:55
temp
/*
* Test fork(), pipe(), etc.
* Author: xcv58
* Date: 2/2/2014
*/
#ifndef _STDIO_H_
#define _STDIO_H_
#include <stdio.h>
#endif
@xcv58
xcv58 / show-absolute-path.sh
Last active August 29, 2015 14:06
Show Path of Shell Script File itself
SCRIPT_FILE=`which $0`
if [ -L $SCRIPT_FILE ]; then
SCRIPT_FILE=`readlink $SCRIPT_FILE`
fi
SCRIPT_PATH=`dirname $SCRIPT_FILE`
SCRIPT_FILE=`basename $SCRIPT_FILE`
echo Path: $SCRIPT_PATH
echo Filename: $SCRIPT_FILE
@xcv58
xcv58 / Use Inbox in Safari.applescript
Created November 19, 2014 22:51
Use Inbox in Safari
tell application "Safari"
activate
tell front window
set current tab to make new tab
end tell
end tell
tell application "System Events"
tell process "Safari"
click menu item 16 of menu 1 of menu item "User Agent" of menu 1 of menu bar item "Develop" of menu bar 1
end tell
@xcv58
xcv58 / CustomHash.java
Created February 10, 2015 15:56
Custom Hash implementation with Java 8 Stream
import java.util.*;
import java.util.stream.*;
public class CustomHash {
public class Entry {
List<Object> list;
public Entry() {
list = new ArrayList<Object>();
}
@xcv58
xcv58 / Temp.java
Last active August 29, 2015 14:17
import java.util.*;
import java.io.*;
public class Temp {
public enum TYPE {
INT, LONG, FLOAT, DOUBLE, STRING, DATE, DECIMAL, CHAR, VARCHAR
}
private List<TYPE> list;
global foundCount
global hideCount
global frontmostCount
on toggle(appPath)
if application appPath is running then
set foundCount to foundCount + 1
if frontmost of application appPath then
if hideCount > 0 then return
set hideCount to hideCount + 1
/*
* Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009
* The President and Fellows of Harvard College.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright