This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <math.h> | |
#include <iostream> | |
#ifndef M_PI | |
#define M_PI (3.14159265358897932) | |
#endif | |
#define TWO_PI (2.0 * M_PI) | |
enum Envelope |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Latency Comparison Numbers | |
-------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#define PIVOT "\x1b[37m" | |
#define LOWERCOLOR "\x1b[38;5;226m" | |
#define UPPERCOLOR "\x1b[38;5;200m" | |
#define GREYRCOLOR "\x1b[38;5;124m" | |
#define RESET "\x1b[0m" | |
void print_nums(int *nums, int numnumbs) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
#include <list> | |
typedef std::vector<int> Ints; | |
using std::vector; | |
bool is_even(int x) | |
{ | |
return x % 2 == 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdbool.h> | |
#include <time.h> | |
int nums_len = 20; | |
static int nums[] = {31, -41, 59, 26, -53, 58, 97, -93, -23, 84, 45, 344, -343, -34, 456, 87, 102, -434, 20, 188}; | |
bool is_bigger(int numone, int numtwo) | |
{ | |
return numtwo > numone ? true : false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdint.h> | |
#include <stdlib.h> | |
// given a number on the command line, prints a string version of the binary val | |
void print_bin(int32_t num) | |
{ | |
for (unsigned int i = 0, j = 2147483648; i < 32; i++, j = j >> 1) | |
{ | |
if (num & j) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
// linked list | |
// | |
typedef struct sweary sweary; | |
struct sweary { | |
char wurd[64]; | |
sweary *next; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import os | |
import re | |
import sys | |
import subprocess | |
READELF = "/usr/bin/readelf" | |
basedir = "" | |
libpattern = re.compile("\[([^\s]*)\]") | |
alllibs = list() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
man() { | |
env \ | |
LESS_TERMCAP_mb=$(printf "\e[1;31m") \ | |
LESS_TERMCAP_md=$(printf "\e[1;31m") \ | |
LESS_TERMCAP_me=$(printf "\e[0m") \ | |
LESS_TERMCAP_se=$(printf "\e[0m") \ | |
LESS_TERMCAP_so=$(printf "\e[1;44;33m") \ | |
LESS_TERMCAP_ue=$(printf "\e[0m") \ | |
LESS_TERMCAP_us=$(printf "\e[1;32m") \ | |
man "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int bignumz[16]; | |
int conv_bitz(int num) | |
{ | |
for ( int i = 0 ; i < 16; i++) { | |
//printf("Comparing %d with %d\n", num, ( 1 << i)); | |
//printf("AND is %d\n", num & ( 1 << i)); | |
if ( (num & ( 1 << i )) == num ) { |
NewerOlder