Skip to content

Instantly share code, notes, and snippets.

Daniel Sockwell codesections

Block or report user

Report or block codesections

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
codesections /
Last active Apr 14, 2019
use futures::{Async, Future, Poll};
use tokio::io::{AsyncRead, AsyncWrite, Error, ReadHalf, WriteHalf};
use tokio::net::TcpStream;
use warp::{path, Filter, Stream};
struct Receiver {
rx: ReadHalf<TcpStream>,
impl Stream for Receiver {
type Item = String;
codesections /
Last active Mar 10, 2019
A proof of concept showing streaming from a Redis pub/sub channel to Server Sent Events
use futures::{Async, Poll};
use redis;
use std::time::Duration;
use warp::{path, Filter, Stream};
struct OutputStream {
con: redis::Connection,
impl OutputStream {
View factorial.lisp
(defun factorial (n)
(if (zerop n) 1 (* n (factorial (1- n)))))
codesections /
Last active Jan 10, 2019
A rust implementation of a simple exercise
fn main() {
println!("{:?}", robot_paths(6));
struct Board {
squares: Vec<Vec<bool>>,
impl Board {
codesections / robotPaths.js
Created Jan 8, 2019
A javascript solution to a simple practice problem
View robotPaths.js
* A robot located at the top left corner of a 5x5 grid is trying to reach the
* bottom right corner. The robot can move either up, down, left, or right,
* but cannot visit the same spot twice. How many possible unique paths are
* there to the bottom right corner?
* make your solution work for a grid of any size.
codesections /
Created Jan 6, 2019
A simple linked list implemented in Rust
pub struct LinkedList {
head: Option<Box<Node>>,
tail: Option<*mut Node>,
struct Node {
value: i32,
next: Option<Box<Node>>,
codesections / linkedList.js
Created Jan 6, 2019
A simple linked list implemented in JavaScript
View linkedList.js
const LinkedList = function() {
this.head = null;
this.tail = null;
LinkedList.prototype.addToTail = function(value) {
const newTail = { value, next: null };
if (this.tail) { = newTail;
codesections /
Created Dec 23, 2018
Linked List with a struct
struct LinkedList {
value: u8,
next: Option<Box<LinkedList>>,
impl LinkedList {
fn new(value: u8) -> LinkedList {
LinkedList { value, next: None }
codesections / nginx.conf
Created Dec 21, 2018
Simple nginx config for static site
View nginx.conf
user root;
worker_processes 4;
events {
worker_connections 1024;
http {
include mime.types;
default_type application/octet-stream;
codesections /
Created Dec 20, 2018
Basic static file server with actix-web
extern crate actix_web;
use actix_web::{fs, server, App};
fn main() {
server::new(|| {
You can’t perform that action at this time.