Skip to content

Instantly share code, notes, and snippets.

Lance Pollard lancejpollard

View GitHub Profile
lancejpollard / binary-addition.js
Created Jul 6, 2020 — forked from nealfennimore/binary-addition.js
Binary addition in javascript
View binary-addition.js
* Add two bits together and get resulting bits
* @param {Number} a bit a
* @param {Number} b bit b
* @returns {Array<Number, Number>} Carry and sum as a result of addition
function addBits(a, b){
return [ +( a && b ), +( a !== b ) ];
View memcpy.asm
page ,132
title memcpy - Copy source memory bytes to destination
;memcpy.asm - contains memcpy and memmove routines
; Copyright (c) Microsoft Corporation. All rights reserved.
; memcpy() copies a source memory buffer to a destination buffer.
; Overlapping buffers are not treated specially, so propogation may occur.
lancejpollard / chacha20.js
Created May 29, 2020 — forked from rumkin/chacha20.js
View chacha20.js
/* chacha20 - 256 bits */
// Written in 2014 by Devi Mandiri. Public domain.
// Implementation derived from chacha-ref.c version 20080118
// See for details:
function U8TO32_LE(x, i) {
return x[i] | (x[i+1]<<8) | (x[i+2]<<16) | (x[i+3]<<24);
lancejpollard / libuv-overview.c
Created Apr 11, 2020
High level overview of libuv looping.
View libuv-overview.c
int uv_run(uv_loop_t* loop, uv_run_mode mode) {
int timeout;
int r;
int ran_pending;
r = uv__loop_alive(loop);
if (!r)
while (r != 0 && loop->stop_flag == 0) {
lancejpollard / client.c
Created Apr 5, 2020 — forked from suyash/client.c
TCP echo client-server in C
View client.c
#include <arpa/inet.h>
#include <stdio.h>
#include <string.h>
#include <sys/socket.h>
#include <unistd.h>
int main() {
const char* server_name = "localhost";
const int server_port = 8877;
lancejpollard / malloc.c
Created Dec 10, 2019 — forked from mshr-h/malloc.c
simple malloc implementation
View malloc.c
/* Include the sbrk function */
#include <unistd.h>
int has_initialized = 0;
void *managed_memory_start;
void *last_valid_address;
void malloc_init() { /* grab the last valid address from the OS*/
last_valid_address = sbrk(0);
/* we don't have any memory to manage yet, so
lancejpollard /
Last active Dec 9, 2019
Folder Structure for Modern Frontend JavaScript Apps

I have thought about folder structures for many years. What I've found is that there is no standard way to represent all things, you have to decide on something and either stick with it, or adopt an evolutionary development mindset (EDM). An EDM is one where you're free to test out new ideas and your code (or in this case, folder structure) is free to evolve into a better and better form as you uncover the mysteries of what is best in your case. You let your team create whatever folder structures they like, without enforcing it, and see what sticks. This will lead to variations in style, but you can then go through and change it again to be even better. Stuff like that.

What I've decided on for the frontend is something like this.


That's it! Now, everything in code in reality is an action if you boil it down. That is what assembly is if you take a look, just a bunch of actions. Every action can be composed into more and more complex action

lancejpollard /
Last active Dec 9, 2019
System Call List for Windows, Mac, and Linux
lancejpollard /
Created Dec 8, 2019 — forked from CMCDragonkai/
Linux: Understanding the Memory Layout of Linux Executables

Understanding the Memory Layout of Linux Executables

Required tools for playing around with memory:

  • hexdump
  • objdump
  • readelf
  • xxd
  • gcore
lancejpollard /
Created Nov 24, 2019
Curses Reference by N. Matloff

Introduction to the Unix Curses Library

Norman Matloff

Department of Computer Science

University of California at Davis

c 1997-2011, N. Matloff April 8, 2011


1 History 2 1.1 Purpose of the Curses Library 1.2 Evolution of the Role of Curses

You can’t perform that action at this time.