Skip to content

Instantly share code, notes, and snippets.

@stevedoyle
stevedoyle / ipp_sha_hash_example.cpp
Created January 25, 2023 15:09
Example of using IPP Crypto Primitives for SHA hashing
#include <iostream>
#include <stdint.h>
#include <x86intrin.h>
#include "ippcp.h"
#include "examples_common.h"
#define DATA_SIZE 1024*1024
#define DIGEST_SIZE 32
#define ITERATIONS 10000
@stevedoyle
stevedoyle / rust-snippets.md
Last active October 20, 2022 09:01
Rust code snippets

Rust Snippets

Pass a Vec<> by reference to a function

let data: vec![0u8; 1024];
foo(data.as_ref()); // Passes an immutable slice

fn foo(data: &[u8]) {
    ...
}
# Read N lines of input, splitting each line and storing the result in a numpy array.
import numpy as np
a = np.array([input().split() for _ in range(N)], int)
@stevedoyle
stevedoyle / Using-Conda.md
Last active November 26, 2021 11:11
Using Conda

Using Conda

Creating a new environment. In this example, the environment is setup to use python 3.10

    $ conda create --name py10 python=3.10

Activating an environment

 $ conda activate py10
@stevedoyle
stevedoyle / vscode-notes.md
Last active July 12, 2021 09:42
Visual Studio Code Notes

Visual Studio Code Notes

Remote SSH

Add proxy details for the remote host to use when loading extensions. Details are added to the settings.json on the remote host.

"http.proxy": "proxy_url:port"

@stevedoyle
stevedoyle / journlctl.md
Last active July 9, 2021 09:54
Linux journlctl usage notes

Journalctl

On newer Linux systems, especially Fedora based, journalctl often replaces the syslog output in /var/log/messages.

Monitoring syslog

Monitor new syslog entries (similar to tail -f /var/log/messages):

journalctl -f

@stevedoyle
stevedoyle / PowerShell-Notes.md
Last active July 22, 2021 14:04
Collection of notes for using Power Shell.

PowerShell Notes

Searching/Grepping files

PowerShell equivalent of egrep:

Select-String <string>

and egrep -r:

dir -Recurse | Select-String <string>

@stevedoyle
stevedoyle / timestamp.h
Last active August 17, 2018 08:38
RDTSC based timestamps
#ifndef _TIMESTAMP_H_
#define _TIMESTAMP_H_
static inline uint64_t timestamp_start(void)
{
union {
uint64_t tsc_64;
struct {
uint32_t lo_32;
uint32_t hi_32;
@stevedoyle
stevedoyle / myutils.py
Last active October 10, 2018 16:08
Misc utilities to simplify common tasks in an iPython shell
def mpps(gbps, size):
return (gbps / (size * 8)) * 1000
def gbps(mpps, size):
return mpps * size * 8 / 1000;
def pkt_size(gbps, mpps):
return (gbps * 1000) / mpps / 8
##################################################
@stevedoyle
stevedoyle / octave.md
Created November 20, 2017 22:55 — forked from obstschale/octave.md
An Octave introduction cheat sheet.

Octave CheatSheet

GNU Octave is a high-level interpreted language, primarily intended for numerical computations.
(via GNU Octave)

Basics

  • not equal ~=
  • logical AND &amp;&amp;