Skip to content

Instantly share code, notes, and snippets.

View nicolasbock's full-sized avatar

Nicolas Bock nicolasbock

View GitHub Profile
#include "Futures.decl.h"
class IntMsg : public CMessage_IntMsg
{
public:
unsigned int counter;
IntMsg () { counter = 0; }
};
@nicolasbock
nicolasbock / cost.py
Last active August 29, 2015 14:09
graph cost vs. sparsemath
import matplotlib.pyplot as plt
import numpy
N = 100
m = 10
M = numpy.array([ M for M in range(1, N) ])
y_graph = N/M*(M+2*m)**3
y_sparse = N*m**2
plt.plot(M, y_graph/y_sparse)
plt.show()
@nicolasbock
nicolasbock / CMakeLists.txt
Created December 3, 2014 20:03
Enclosing functions in Fortran
project( enclosing-functions Fortran )
add_executable( test
test.F90
func.F90
)
# Doxyfile 1.8.5
# This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project.
#
# All text after a double hash (##) is considered a comment and is placed in
# front of the TAG it is preceding.
#
# All text after a single hash (#) is considered a comment and will be ignored.
# The format is:

Keybase proof

I hereby claim:

  • I am nicolasbock on github.
  • I am nicolasbock (https://keybase.io/nicolasbock) on keybase.
  • I have a public key whose fingerprint is E0D8 020A 7F1F C428 ED09 8048 7F5E 6D64 AC91 CA52

To claim this, I am signing this object:

@nicolasbock
nicolasbock / allocate_from_source.F90
Created January 29, 2015 00:59
using a source when allocating in Fortran
program test
type :: a_t
integer, pointer :: i => null()
end type a_t
type(a_t), pointer :: a, b
nullify(a, b)
@nicolasbock
nicolasbock / split-PRs.sh
Created August 16, 2016 04:22
Split the last two commits on the master branch into two separate branches
#!/bin/bash
mkdir split-PRs
cd split-PRs
git init
touch file1
git add file1
git commit -m "Adding file1 (last commit on master)"
diff -Naur mutt-1.7.1-orig/crypt.c mutt-1.7.1/crypt.c
--- mutt-1.7.1-orig/crypt.c 2016-10-08 13:35:50.000000000 -0600
+++ mutt-1.7.1/crypt.c 2016-11-03 09:16:15.447959488 -0600
@@ -252,10 +252,22 @@
if ((WithCrypto & APPLICATION_PGP)
&& (msg->security & APPLICATION_PGP))
{
- if (!(pbody = crypt_pgp_encrypt_message (tmp_pgp_pbody, keylist,
- flags & SIGN)))
+ char *new_keylist = keylist;
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 52:54:00:7a:de:ee brd ff:ff:ff:ff:ff:ff
inet 192.168.122.195/24 brd 192.168.122.255 scope global ens3
valid_lft forever preferred_lft forever
@nicolasbock
nicolasbock / test-rabbitmq.py
Created March 27, 2020 20:13
rabbitmq tester
#!/usr/bin/env python
import argparse
import pika
import amqp
import sys
def parse_command_line():
parser = argparse.ArgumentParser()
parser.add_argument(