Skip to content

Instantly share code, notes, and snippets.

@barik
barik / gist:3354739
Created August 15, 2012 01:52
org-mode indent
#+BEGIN
for x in range(1,6):
print x
#+END
@barik
barik / gist:3299055
Created August 8, 2012 21:44
ciigar firewall
Chain INPUT (policy ACCEPT)
target prot opt source destination
RH-Firewall-1-INPUT all -- anywhere anywhere
Chain FORWARD (policy ACCEPT)
target prot opt source destination
RH-Firewall-1-INPUT all -- anywhere anywhere
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
// Some type of object without properties can be shortcutted.
if (keys.length === 0) {
if (typeof value === 'function') {
var name = value.name ? ': ' + value.name : '';
return ctx.stylize('[Function' + name + ']', 'special');
}
if (isRegExp(value)) {
return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
}
if (isDate(value)) {
/* BOOL fnEditPath(char *ExistingPath);
*
* Function will add the szSetupPath to the users path statement in the
* autoexec.bat file. The szSetupPath will be the first location in the
* path statement. The path can be in about a million fucked up forms
* depending on the level of stupidity in the user. Here are a few to
* think about. DOS will accept any of these.
*
* PATH=C:\foo;C:\foobar;...
* SET PATH=C:\foo;C:\foobar;...
@barik
barik / gist:3140646
Created July 19, 2012 03:47
Sumatra PDF with Emacs
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(TeX-PDF-mode t)
'(TeX-master nil)
'(TeX-source-correlate-method (quote synctex))
'(TeX-source-correlate-mode t)
'(TeX-source-correlate-start-server (quote ask))
(global-set-key "\C-cl" 'org-store-link)
(define-key global-map "\C-cc" 'org-capture)
http://stackoverflow.com/questions/906368/what-is-the-difference-between-global-set-key-and-define-key-global-map-in-e
@barik
barik / gist:3057703
Created July 6, 2012 02:31
Emacs Buffer Change Mode
(setq default-major-mode (lambda ()
(let ((buffer-file-name
(or buffer-file-name (buffer-name))))
(set-auto-mode))))
@barik
barik / gist:3020734
Created June 29, 2012 21:24
java magic
c:\Windows\System32>dir java.exe
Volume in drive C is Windows7_OS
Volume Serial Number is 8ACF-6025
Directory of c:\Windows\System32
06/25/2012 10:35 PM 188,840 java.exe
1 File(s) 188,840 bytes
0 Dir(s) 164,390,166,528 bytes free
> d5.rat
0 1 2 3 4 5
d5.rat 31 203 244 297 184 25
0 328 164 164 328 0
> chisq.test(d5.rat)
Pearson's Chi-squared test
data: d5.rat
X-squared = 179.9828, df = 5, p-value < 2.2e-16
0 1 2 3 4 5
P120 2 1 10 11 0 0
P249 0 1 6 17 0 0
P356 2 0 11 11 0 0
P488 0 0 11 12 1 0
P597 0 12 0 0 11 1 <-- hmm
P748 2 1 9 11 0 1