Skip to content

Instantly share code, notes, and snippets.

@parsa
parsa / mdspan.hpp
Created November 22, 2019 18:34
Single-Header distribution of https://github.com/kokkos/mdspan
#pragma once
#include <type_traits> // std::is_void
#include <cstddef>
#include <type_traits>
#include <utility> // integer_sequence
#include <type_traits>
#include <array>
#include <utility>
#include <cstddef>
#include <cstddef> // ptrdiff_t
0
1
2
3
4
5
6
7
8
9
#include <iostream>
#include <span>
int main()
{
int a[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
std::span<int> b(a);
auto c = b.subspan(1, 3);
for (auto& i : c)
#include <exception>
#include <iostream>
#include <sstream>
#include <string>
template <typename... Ts>
std::string tprintf(char const* format, Ts... vs);
template <typename E=std::runtime_error, typename... Ts>
inline std::exception formatted_exception(Ts... vs)
@parsa
parsa / AddWithCuda.cpp
Created April 26, 2019 19:59
CUDA Hello World C++/CLI
#include "stdafx.h"
using namespace System;
#include "cuda_runtime.h"
cudaError_t addWithCuda(int *c, int const* a, int const* b, unsigned int size);
int main(array<System::String ^> ^args)
{
@parsa
parsa / hpx-dnf.sh
Created April 15, 2019 15:27
HPX through DNF on Fedora
# docker run -it --rm fedora
#find / -iname 'hpx*config.cmake'
dnf install hpx-mpich-devel gcc-c++ cmake make ninja-build environment-modules vim -y
source /usr/share/Modules/init/bash
module load mpi/mpich-x86_64
mkdir -p /work
cd /work
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BackgroundColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS
AAGGoKMHCA9VJG51bGzTCQoLDA0OV05TV2hpdGVcTlNDb2xvclNwYWNlViRjbGFzc00w
IDAuODk5OTk5OTgAEAOAAtIQERITWiRjbGFzc25hbWVYJGNsYXNzZXNXTlNDb2xvcqIS
FFhOU09iamVjdF8QD05TS2V5ZWRBcmNoaXZlctEXGFRyb290gAEIERojLTI3O0FIUF1k
@parsa
parsa / ssh-key-to-fingerprint.md
Last active July 18, 2023 05:26
Generate MD5 and SHA256 fingerprint of an OpenSSH host

Generate MD5 and SHA256 fingerprint of an OpenSSH host

MD5

# ssh-keyscan -p 8000 -t rsa rostam.cct.lsu.edu 2>/dev/null | awk '{ print $3 }' | base64 -d | md5sum | awk '{ print $1 }' | fold -w2 | paste -sd':' -
71:5a:1d:bb:1f:1e:fa:e6:34:98:3d:48:f5:ce:9d:68
# ssh-keygen -l -E md5 -f <(ssh-keyscan -p 8000 -t rsa rostam.cct.lsu.edu 2>/dev/null)
2048 MD5:71:5a:1d:bb:1f:1e:fa:e6:34:98:3d:48:f5:ce:9d:68 [rostam.cct.lsu.edu]:8000 (RSA)
@parsa
parsa / embedded-file-viewer.md
Last active March 12, 2019 21:10 — forked from tzmartin/embedded-file-viewer.md
Embedded File Viewer: Google Drive, OneDrive

Office Web Apps Viewer

('.ppt' '.pptx' '.doc', '.docx', '.xls', '.xlsx')

http://view.officeapps.live.com/op/view.aspx?src=[OFFICE_FILE_URL]

<iframe src='https://view.officeapps.live.com/op/embed.aspx?src=[OFFICE_FILE_URL]' width='px' height='px' frameborder='0'>
</iframe>

OneDrive Embed Links