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 python3 | |
""" | |
Stock Options Calculator | |
Helps you get a fair idea of the costs involved and profits that can be gained in the future. | |
Example Usage: | |
# --option-grant 10000,0.25 10000,0.5 --exercise-fmv 1.25 --income-tax-rate 0.3 --exercise-exch-rate 73 --sale-fmv 2.5 --capital-gain-rate 0.2 --sale-exch-rate 75 --indexation-ratio 1.075 | |
""" |
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
// Reformatted the code available at https://github.com/Andersbakken/openssl-examples/blob/master/read_write.c | |
// The code is hopefully easier to understand now | |
#include <fcntl.h> | |
#include <openssl/ssl.h> | |
#include <unistd.h> | |
void err_exit(const char *s) | |
{ | |
/* TODO: Implement an exit function */ |
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 python3 | |
import asyncio | |
import ssl | |
@asyncio.coroutine | |
async def echo_client(data, loop): | |
ssl_ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) | |
ssl_ctx.options |= ssl.OP_NO_TLSv1 |
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
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
Lesson 1 SUMMARY | |
1. The cursor is moved using either the arrow keys or the hjkl keys. | |
h (left) j (down) k (up) l (right) | |
2. To start Vim from the shell prompt type: vim FILENAME <ENTER> | |
3. To exit Vim type: <ESC> :q! <ENTER> to trash all changes. |
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
CXX=clang++ | |
CXXFLAGS=-Wall -Werror -std=c++11 | |
all: $(patsubst %.cpp, %.out, $(wildcard *.cpp)) | |
%.out: %.cpp Makefile | |
$(CXX) $(CXXFLAGS) $< -o $(@:.out=) | |
clean: $(patsubst %.cpp, %.clean, $(wildcard *.cpp)) |
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 | |
# CS 161 - Design and Analysis of Algorithms - Tim Roughgarden | |
# | |
# Script to rename FLV files using their XML containing metadata. | |
# I personally prefer the blackboard videos, so wrote a script to rename the | |
# videos to have proper titles. | |
# | |
# This is a script that gets job done, not something you'd want to integrate | |
# into some production code, so use it at your own risk. |
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 bash | |
# Generate the root CA certificate | |
# Generate a self signed certificate for the CA along with a key. | |
mkdir -p ca/private | |
mkdir -p ca/newcerts | |
chmod 700 ca/private | |
# NOTE: I'm using -nodes, this means that once anybody gets | |
# their hands on this particular certificate they can become this CA. | |
openssl req \ |
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 <stddef.h> | |
typedef struct inner { | |
int i_a; | |
int i_b; | |
int i_c; | |
} inner_t; | |
typedef struct outer { | |
int o_a; |
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
/** | |
* Bit hacks | |
* | |
* Not as extensive as https://graphics.stanford.edu/~seander/bithacks.html | |
* but I want a quick reference for myself | |
*/ | |
// multiply x by 2^n | |
int mul_pow2(int x, int n) { | |
return x << n; |
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
# Move to root directory... | |
cd / | |
mkdir keys | |
cd keys | |
# Generate a self signed certificate for the CA along with a key. | |
mkdir -p ca/private | |
chmod 700 ca/private | |
# NOTE: I'm using -nodes, this means that once anybody gets | |
# their hands on this particular key, they can become this CA. |
NewerOlder