Skip to content

Instantly share code, notes, and snippets.

View pranavcode's full-sized avatar

Pranav Kulkarni pranavcode

View GitHub Profile
@pranavcode
pranavcode / error_16ps_run1_XeonE5.log
Last active August 29, 2015 14:14
Exception while running odeint-v2 MPI Phase Chain example. MPI code can be found here - https://github.com/headmyshoulder/odeint-v2/blob/master/examples/mpi/phase_chain.cpp
[test-X9DAi:13934] *** Process received signal ***
[test-X9DAi:13934] Signal: Segmentation fault (11)
[test-X9DAi:13934] Signal code: Address not mapped (1)
[test-X9DAi:13934] Failing at address: 0xd8dc3be9
terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::mpi::exception> >'
what(): MPI_Send: MPI_ERR_COUNT: invalid count argument
[test-X9DAi:13933] *** Process received signal ***
[test-X9DAi:13933] Signal: Aborted (6)
[test-X9DAi:13933] Signal code: (-6)
[test-X9DAi:13934] [ 0] /lib/x86_64-linux-gnu/libc.so.6(+0x36d40) [0x7fab82bb3d40]
@pranavcode
pranavcode / gitupgardebrewerror.txt
Created February 10, 2015 17:29
Homebrew's curl failure log while upgrading 'git'
==> Upgrading 1 outdated package, with result:
git 2.3.0
==> Upgrading git
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/git-2.3.0.yosemite.bottle.tar.gz
curl: (60) SSL certificate problem: Invalid certificate chain
More details here: http://curl.haxx.se/docs/sslcerts.html
curl performs SSL certificate verification by default, using a "bundle"
of Certificate Authority (CA) public keys (CA certs). If the default
@pranavcode
pranavcode / performance_newline.cpp
Created February 14, 2015 11:41
C++ performance test - '\n' vs std::endl
// Timing the performance
// Example: '\n' vs std::endl
// The winner is given at the end
#include <cmath>
#include <iostream>
#include <fstream>
#include <time.h>
// This is just a pseudo-code.
//
// File: common_header.hpp
//
void current(state_type &variables, state_type &dxdt, const double t, int index, vector<string> var_param_names_from_isf) {
// this fucntion has common code
// just that the name for variable is acquired from
// var_param_names_from_isf vector by accessing its index
// e.g. index x - var_param_names_from_isf[x]
@pranavcode
pranavcode / isf-comment.el
Created July 23, 2015 06:21
INSILICO input file mode
;; command to comment/uncomment text
(defun insilico-mode-comment-dwim (arg)
"Comment or uncomment current line or region in a smart way. For detail, see comment-dwim'."
(interactive "*P")
(require 'newcomment)
(let ((comment-start "\"") (comment-end "\"") (comment-padding nil))
(comment-dwim arg)))
;; A custom mode for editing insilico isf files
;; keywords for syntax coloring
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1
@pranavcode
pranavcode / de.yml
Created July 17, 2016 19:47 — forked from smtm/de.yml
Parsing YAML in Rails i18n locale files to generate JSON for a javascript translation method
These are the code parts to grab related to this blog post.
Read more about it there
http://www.igumbi.com/en/blog/YAML-to-JSON-Rails-for-i18n-Language-Files
# The locale file structure de.yml
de:
obt:
@pranavcode
pranavcode / flatten-array.rb
Created June 23, 2018 16:46
Flatten the array in ruby without using inbuilt Array#flatten
#!/usr/bin/env ruby
def flatten(array)
array.each_with_object([]) do |e, flat|
flat.push *(e.is_a?(Array) ? flatten(e) : e)
end
end
print flatten([[1, 2, 3, 4], 5, 6, [[7, 8], 9, 0]])
@pranavcode
pranavcode / download-consul-linux-64bit
Last active March 10, 2019 08:00
Velotio - HashiCorp Consul Part 1 - Download Consul
$ wget https://releases.hashicorp.com/consul/1.4.3/consul_1.4.3_linux_amd64.zip -O consul.zip
--2019-03-10 00:14:07-- https://releases.hashicorp.com/consul/1.4.3/consul_1.4.3_linux_amd64.zip
Resolving releases.hashicorp.com (releases.hashicorp.com)... 151.101.37.183, 2a04:4e42:9::439
Connecting to releases.hashicorp.com (releases.hashicorp.com)|151.101.37.183|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 34777003 (33M) [application/zip]
Saving to: ‘consul.zip’
consul.zip 100%[============================>] 33.17M 4.46MB/s in 9.2s
@pranavcode
pranavcode / unzip-downloaded-consul
Last active March 10, 2019 08:00
Velotio - HashiCorp Consul Part 1 - Unzip Download Consul
$ unzip consul.zip
Archive: consul.zip
inflating: consul