Skip to content

Instantly share code, notes, and snippets.

View leannejdong's full-sized avatar
💭
I may be slow to respond.

Leanne Dong leannejdong

💭
I may be slow to respond.
View GitHub Profile
@peterhurford
peterhurford / parallelization.md
Created October 17, 2015 22:04
How does code get parallelized?

Computer code is a series of executed statements. Frequently, these statements are executed one at a time. If one part of your code takes a long time to run, the rest of your code won't run until that part is finished.

However, this isn't how it has to be. We can often make the exact same code go much faster through parallelization, which is simply running different parts of the computer code simaltaneously.

Asynchronous Code

The first example of this is asynchronous code. The idea here is that many times you do things like send a call to another computer, perhaps over the internet, using an API. Normally, code then has to simply wait for the other computer to give it a response over the API. But asynchronous code can simply keep on going and then the API call returns later.

This makes code harder to reason about and handle because you don't know when the API call will return or what your code will be like when it returns, but it makes your code faster because you don't have to wait arou

@phg1024
phg1024 / eigen_matlab.cpp
Created October 28, 2015 00:12
Eigen-MATLAB reference
// A simple quickref for Eigen. Add anything that's missing.
// Main author: Keir Mierle
#include <Eigen/Dense>
Matrix<double, 3, 3> A; // Fixed rows and cols. Same as Matrix3d.
Matrix<double, 3, Dynamic> B; // Fixed rows, dynamic cols.
Matrix<double, Dynamic, Dynamic> C; // Full dynamic. Same as MatrixXd.
Matrix<double, 3, 3, RowMajor> E; // Row major; default is column-major.
Matrix3f P, Q, R; // 3x3 float matrix.
@briandk
briandk / InstallingPandocOnMac.md
Last active April 9, 2025 01:10
How to install pandoc on a mac

Step 0 - Installing the XCode Development tools

Paste the following in your terminal, then press Enter and follow any prompts:

xcode-select --install

Step 1 - Install homebrew

@quickgrid
quickgrid / WeightedUndirectedAdjacencyListGraphVectorListImplementation.cpp
Created May 16, 2016 16:18
Inputting and Representing an Weighted Undirected graph in adjacency list in vector of list structure. Easy C++ STL implementation and explanation based on visual representation.
/**
* Author: Asif Ahmed
* Site: http://quickgrid.blogspot.com
* Description: Inputting and Representing an Weighted Undirected graph
* in adjacency list vector list pair using C++ STL.
*/
#include<bits/stdc++.h>
using namespace std;
@wangyangkobe
wangyangkobe / main.cpp
Created July 14, 2016 00:29
Akuna Capital (Shanghai) C++ Coding Challenge For Regular Program
#include <iostream>
#include <fstream>
#include <stdint.h>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
using namespace std;
#pragma pack(push)
import time
class Bucket(object):
def __init__(self, max_amount, refill_time, refill_amount):
self.max_amount = max_amount
self.refill_time = refill_time
self.refill_amount = refill_amount
self.reset()
def _refill_count(self):
@don-smith
don-smith / arch-setup.md
Last active August 9, 2022 06:20
How I setup my Arch Linux installs

My Arch Linux Setup Guide

This guide assumes the drive has already been partitioned and the EFI bootloader is already in place. I'll include these detailed steps the next time I need to do it. As I'm writing up these steps, I'm performing them on a machine that's already had it done, and I can't spend the time to start from scratch this time.

Arch Installation

  • Start with a bootable thumb drive that includes the latest version
@omaraflak
omaraflak / main.cpp
Last active November 6, 2024 12:42
Image convolution in C++ + Gaussian blur
#include <iostream>
#include <vector>
#include <assert.h>
#include <cmath>
#include <png++/png.hpp>
using namespace std;
typedef vector<double> Array;
typedef vector<Array> Matrix;
@kmhofmann
kmhofmann / building_tensorflow.md
Last active December 16, 2024 20:45
Building TensorFlow from source

Building TensorFlow from source (TF 2.3.0, Ubuntu 20.04)

Why build from source?

The official instructions on installing TensorFlow are here: https://www.tensorflow.org/install. If you want to install TensorFlow just using pip, you are running a supported Ubuntu LTS distribution, and you're happy to install the respective tested CUDA versions (which often are outdated), by all means go ahead. A good alternative may be to run a Docker image.

I am usually unhappy with installing what in effect are pre-built binaries. These binaries are often not compatible with the Ubuntu version I am running, the CUDA version that I have installed, and so on. Furthermore, they may be slower than binaries optimized for the target architecture, since certain instructions are not being used (e.g. AVX2, FMA).

So installing TensorFlow from source becomes a necessity. The official instructions on building TensorFlow from source are here: ht

@jnaecker
jnaecker / git+overleaf+github.md
Last active March 10, 2025 21:00
Using Overleaf as your TeX editor but getting your files to Github

git + overleaf + github

Setup

Connect Overleaf and your local repo

  1. Make a new project on Overleaf.
  2. In the share menu, copy the link from "Clone with git"
  3. On your computer:
    • use cd to navigate to where you want to put your project