Skip to content

Instantly share code, notes, and snippets.

@ofan
ofan / pi.cpp
Last active August 29, 2015 13:56
#include <math.h>
#include <mpich-devel-clang/mpi.h>
#include <iostream>
using namespace std;
int main(int argc, char* argv[]){
int n, rank, size, i;
// PI25DT is used for computing error
#include <mpi.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char* argv[]){
MPI_Init(&argc, &argv);
int size, rank;
MPI_Comm_size(MPI_COMM_WORLD, &size);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
int data;
vpn.ofan.me
#include <iostream>
#include <cstdlib>
using namespace std;
int main(int argc, char* argv[]){
string in(argv[1]);
long res=0;
int pn = 0;
for(auto i=in.begin(); i!=in.end(); ++i){
#!/bin/bash
if [ -z "`ps aux | grep 'emacs --daemon'|grep -v grep`" ];then
echo "Daemon is not started,starting daemon..."
emacs --daemon >/dev/null 2>&1
fi
list=`wmctrl -l|grep "emacs"`
if [ -z "$list" ];then
emacsclient -nc $*
else
import sys
from gmpy import *
if __name__ == '__main__':
print fac(int(sys.argv[1]))
import sys
def fac(n):
if n==0:
return 1
r=1
for i in xrange(2,n+1):
r*=i
return r
if __name__ == '__main__':
import sys
from gmpy import *
def fac(n):
if n==0:
return 1
r=mpz(1)
for i in xrange(2,n+1):
r*=i
return r
PING 61.184.202.221 (61.184.202.221) 56(84) bytes of data.
64 bytes from 61.184.202.221: icmp_req=1 ttl=116 time=279 ms
64 bytes from 61.184.202.221: icmp_req=2 ttl=116 time=278 ms
64 bytes from 61.184.202.221: icmp_req=3 ttl=116 time=278 ms
64 bytes from 61.184.202.221: icmp_req=4 ttl=116 time=280 ms
traceroute to 61.184.202.221 (61.184.202.221), 30 hops max, 40 byte packets
1 192.168.0.1 (192.168.0.1) 0.587 ms 0.516 ms 0.525 ms
2 * 61.184.202.221 (61.184.202.221) 288.025 ms *