Skip to content

Instantly share code, notes, and snippets.

View rust-reqwest-stream-example.rs
let offset = 20000;
let chunk_size = 10000;
// File handle:
let mut handle = BufReader::new(File::open("data.bin").await?);
// Set cursor to needed chunk:
let mut chunk_stream = handle
.bytes()
.skip(offset)
View writing-a-mark-sweep-garbage-collector.cpp
/**
* Writing a Mark-Sweep Garbage Collector in C++.
*
* This is a source code for the Lecture 9 from the
* Essentials of Garbage Collectors course:
*
* http://dmitrysoshnikov.com/courses/essentials-of-garbage-collectors/
*
* See full details in:
*
@DmitrySoshnikov
DmitrySoshnikov / GIF-Screencast-OSX.md
Created Jan 30, 2020 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF
View GIF-Screencast-OSX.md

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@DmitrySoshnikov
DmitrySoshnikov / sierpinski-triangle.html
Created Dec 2, 2019
Sierpiński triangle in JavaScript
View sierpinski-triangle.html
<!DOCTYPE html>
<html>
<head>
<title>Sierpiński triangle</title>
</head>
<body>
<canvas id="area" width="600" height="600"></canvas>
<script type="text/javascript">
// Sierpiński_triangle:
View thread-safe-mutex.cpp
/**
* -------------------------------------------
* Thread-safe vs. Non-thread-safe. Mutex.
* -------------------------------------------
*
* Some resources (like global `cout` stream) have to be guarded
* in order to be thread-safe.
*
* The simplest way to guard is to use a mutex:
*
View filter-props.js
/**
* Filter object properties.
*
* by Dmitry Soshnikov <dmitry.soshnikov@gmail.com>
* MIT Style license, 2019
*/
const filterProps = (
[p1, p2, p3],
{
View async-iterators-example.js
/**
* Async iterators simple example.
*
* by Dmitry Soshnikov <dmitry.soshnikov@gmail.com>
* MIT Style License, 2018
*/
async function* streamChunks() {
yield genChunk(1);
yield genChunk(2);
View malloc.js
/**
* Educational "Free-list" memory allocator.
*
* Maintains explicit list of free memory blocks, reuses blocks on free.
* Implements "first-fit" strategy. Uses pre-allocated heap of 64 bytes,
* with 32-bit machine word size.
*
* TODO:
*
* - Implement "best-fit" strategy
View snake6502.asm
; ___ _ __ ___ __ ___
; / __|_ _ __ _| |_____ / /| __|/ \_ )
; \__ \ ' \/ _` | / / -_) _ \__ \ () / /
; |___/_||_\__,_|_\_\___\___/___/\__/___|
; An annotated version of the snake example from Nick Morgan's 6502 assembly tutorial
; on http://skilldrick.github.io/easy6502/ that I created as an exercise for myself
; to learn a little bit about assembly. I **think** I understood everything, but I may
; also be completely wrong :-)
@DmitrySoshnikov
DmitrySoshnikov / syntax.s
Created Jan 27, 2018 — forked from mishurov/syntax.s
AT&T assembly syntax and IA-32 instructions
View syntax.s
# --------
# Hardware
# --------
# Opcode - operational code
# Assebly mnemonic - abbreviation for an operation
# Instruction Code Format (IA-32)
# - Optional instruction prefix
# - Operational code
You can’t perform that action at this time.