This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
#include <time.h> | |
#include <mach/mach_time.h> | |
#include <gmp.h> | |
void factorial(mpz_t n, mpz_t res) | |
{ | |
mpz_t unit, zero, cnt; | |
mpz_init_set_ui (unit, 1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(module fact) | |
(define *num-list* '(1 12 123 1234 12345 123456)) | |
(define (factorial n) | |
(define (iter k acc) | |
(if (= k 1) | |
acc | |
(iter (- k 1) (* k acc)))) | |
(iter n 1)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#PBS -l nodes=1 | |
cd $PBS_O_WORKDIR | |
reconstructPar -case $PBS_O_WORKDIR > $PBS_O_WORKDIR/log.reconstructPar |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fvPatchList& patches = mesh.boundary(); | |
forAll(patches, patchi) | |
{ | |
const fvPatch& curPatch = patches[patchi]; | |
if (isType<wallFvPatch>(curPatch)) | |
{ | |
forAll(curPatch, facei) | |
{ | |
label faceCelli = curPatch.faceCells()[facei]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; for OpenFOAM | |
(c-add-style "OpenFOAM_HGW" | |
'( | |
(c-basic-offset . 4) | |
(c-tab-always-indent . t) | |
(indent-tabs-mode . nil) | |
(c-comment-only-line-offset . (0 . 0)) | |
(c-indent-comments-syntactically-p . t) | |
(c-block-comments-indent-p nil) | |
(c-cleanup-list . |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" OpenFOAM/FreeFOAM | |
autocmd BufRead *.[CH] set expandtab shiftwidth=4 filetype=cpp | |
autocmd BufRead *.[CH] set cindent cinoptions=+s-2,(s,U1,is,g0,Ws,l1,t0 cinkeys=0{,0},0),:,!^F,o,O,e |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
CHAIN=SELFCONTROL | |
IPTABLES=/sbin/iptables | |
IP_PATTERN='/^[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}$/p' | |
usage() { | |
echo "Usage: $0 <IP address or hostname>" | |
exit 1 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def point_on_arc(radius, start_x, start_y, end_x, end_y): | |
""" | |
Returns set of possible points on arc given by start and end points and | |
circle radius. | |
Return value is dictionary with keys 'center' and 'points'. | |
Center is associated with list of tuples with possible center coordinates. | |
Points is associated with list of tuples with possible points on the arc. | |
""" | |
X = start_x - end_x | |
Y = start_y - end_y |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fetchInlineImage() { | |
var results = GmailApp.search("Subject: Inline Image Test"); | |
for(var i in results) { | |
var thread = results[i]; | |
messages = thread.getMessages(); | |
for(var j in messages) { | |
var msg = messages[j]; | |
var pattern = /<img.*src="([^"]*)"[^>]*>/; | |
var matches = pattern.exec(msg.getBody()); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"math/big" | |
"strings" | |
"strconv" | |
"time" | |
) |