Skip to content

Instantly share code, notes, and snippets.

View Jared-Prime's full-sized avatar
📚

Jared Davis Jared-Prime

📚
View GitHub Profile
@alandipert
alandipert / fibers.rb
Created May 7, 2011 20:42
Clojure-inspired fibonacci streams with Fibers
require 'fiber'
class Fiber
def map &block
Fiber.new { loop { Fiber.yield block.call(resume) } }
end
def to_a
[].tap{|xs| xs << resume while alive?}
ActiveRecord::Schema.define(:version => 20120620132905) do
create_table "tasks", :force => true do |t|
t.string "name"
t.integer "sender_id"
t.integer "receiver_id"
end
create_table "users", :force => true do |t|
t.string "name"
end
@Gonzih
Gonzih / futures.rb
Last active August 29, 2015 14:01
Fun with cuncurrency in jruby
class Future
include java.util.concurrent.Callable
@@executor = java.util.concurrent.Executors::newFixedThreadPool(5)
def initialize(&block)
@block = block
end
def on_success(&block)
@markpapadakis
markpapadakis / simpleStacklessCorosActors.cpp
Last active June 21, 2020 09:43
A very simple (first take) implementation of stack-less coroutines/actors
// https://gist.github.com/markpapadakis/8dba5c480c13b12a056e (example)
// https://medium.com/@markpapadakis/high-performance-services-using-coroutines-ac8e9f54d727
#include <switch.h>
#include <switch_print.h>
#include <switch_ll.h>
#include <switch_bitops.h>
#include <md5.h>
#include <text.h>
#include <network.h>
@mcastilho
mcastilho / gist:e051898d129b44e2f502
Last active June 23, 2023 18:33
Cheap MapReduce in Go
package main
import (
"bufio"
"encoding/csv"
"encoding/json"
"fmt"
"io"
"os"
"path/filepath"
@jamtur01
jamtur01 / ladder.md
Last active July 4, 2024 19:31
Kickstarter Engineering Ladder
@Jared-Prime
Jared-Prime / clean_docker_images.py
Created January 26, 2016 22:34 — forked from DrMavenRebe/clean_docker_images.py
Remove unlinked space from the docker drive
#!/usr/bin/env python
"""
Check all existing Docker containers for their mapped paths, and then purge any
zombie directories in docker's volumes directory which don't correspond to an
existing container.
Taken from: https://github.com/docker/docker/issues/6354
"""
import logging
import os
@JPvRiel
JPvRiel / linux_memory_control_to_avoid_swap_thrashing.md
Created November 7, 2016 22:29
Notes on linux memory management options to prioritize and control memory access using older ulimits, newer cgroups and overcommit policy settings. Mostly as an attempt to keep a desktop environment responsive and avoid swap thrashing under high memory pressure.

Overview

Some notes about:

  • Explaining why current day Linux memory swap thrashing still happens (as of 2016).
  • Mitigating "stop the world" type thrashing issues on a Linux workstation when it's under high memory pressure and where responsiveness is more important than process completion.
  • Prioritizing and limiting memory use.
  • Older ulimit versus newer CGroup options.

These notes assume some basic background knowledge about memory management, ulimits and cgroups.

@mrkgnao
mrkgnao / Neural.idr
Last active July 30, 2022 15:00
A quick Idris implementation of @mstksg's "dependent Haskell" neural networks
module Main
import Data.Vect
-- %hide transpose
dot : Num a => Vect n a -> Vect n a -> a
dot va vb = foldr (+) 0 $ zipWith (*) va vb
Matrix : (rows : Nat) -> (cols : Nat) -> Type -> Type
#!/usr/bin/env bash
# BASH TIPS -
# http://kvz.io/blog/2013/11/21/bash-best-practices/
set -o errexit
set -o nounset
set -o xtrace
# TMUX CONFIG