Skip to content

Instantly share code, notes, and snippets.

I was drawn to programming, science, technology and science fiction
ever since I was a little kid. I can't say it's because I wanted to
make the world a better place. Not really. I was simply drawn to it
because I was drawn to it. Writing programs was fun. Figuring out how
nature works was fascinating. Science fiction felt like a grand
adventure.
Then I started a software company and poured every ounce of energy
into it. It failed. That hurt, but that part is ok. I made a lot of
mistakes and learned from them. This experience made me much, much
@juancarlospaco
juancarlospaco / 0README.md
Last active June 8, 2021 19:14
Python Versus Nim: Async

Python Versus Nim: Async

  • No performance benchmark.
  • Python ⟿ PEP-8
  • Nim ⟿ NEP1
  • Python ⟿ 3.7
  • Nim ⟿ 0.19
  • No Ofuscation, no Code-Golf.

This is to compare elegant, simple, expressive code.

@jzakiya
jzakiya / twinprimes_ssoz.nim
Last active August 12, 2024 17:06
Twinprimes generator, multi-threaded, using SSoZ (Segmented Sieve of Zakiya), written in Nim
#[
This Nim source file is a multiple threaded implementation to perform an
extremely fast Segmented Sieve of Zakiya (SSoZ) to find Twin Primes <= N.
Inputs are single values N, or ranges N1 and N2, of 64-bits, 0 -- 2^64 - 1.
Output is the number of twin primes <= N, or in range N1 to N2; the last
twin prime value for the range; and the total time of execution.
Code originally developed on a System76 laptop with an Intel I7 6700HQ cpu,
2.6-3.5 GHz clock, with 8 threads, and 16GB of memory. Parameter tuning
@cipharius
cipharius / yes-in-nim.md
Last active January 22, 2018 17:41
Blazing fast yes in Nim

Recently I stumbled upon a post which takes a closer look at the yes command line tool. The main purpose of it is to write endless stream of a single letter y at a ridiculous speed.

On the first glance this seems like a really simple problem, just two lines of Nim and you're done, right?

while true:
  echo "y"

And indeed, this gives us plenty of y's. But when we take a look at the write speed..

@RedBeard0531
RedBeard0531 / nimsuggest.vim
Created January 10, 2018 22:04
Terrible implementation of nimsuggest integration with zah/nim.vim
" :source this file in your "main" nim file to activate.
" You can run :source again to switch main file or when nimsuggest crashes.
" You can also :call nimsuggest#run('use') to see all uses of the thing your
" cursor is on.
"call system("killall nimsuggest")
let nimsuggest_job = job_start(["nimsuggest", "--stdin", "--v2", "--debug", "--log", expand("%")], {
\ "in_mode" : "nl",
\ "out_mode" : "nl",
\ "err_io": "out",
@evacchi
evacchi / sharedqueue.nim
Last active June 10, 2017 13:50
Shared Queue
import locks, options
#
# Simple shared queue implementation
# Translated into Nim from https://idea.popcount.org/2012-09-11-concurrent-queue-in-c/
#
type
SharedQueueNode[A] = ptr object
@elithrade
elithrade / vimfiler-shortcuts
Last active October 12, 2022 21:13
Common vimfiler keyboard shortcuts
Toggle safe mode: gs
Create new file: N
Delete file: d
Rename file: r
New directory: K
Open file: e
Move file: m
Open VimFilerExplorer: e
Open current directory in a new buffer: dl
Open current directory in a new split: ds
@zacharycarter
zacharycarter / wclwn.md
Last active August 19, 2024 03:44
Binding to C Libraries with Nim
@renechz
renechz / predawn.vim
Created June 9, 2015 18:40
vim port of predawn.tmTheme color scheme - https://github.com/jamiewilson/predawn
" Vim color file
" Converted from Textmate theme Predawn using Coloration v0.4.0 (http://github.com/sickill/coloration)
set background=dark
highlight clear
if exists("syntax_on")
syntax reset
endif
@sebmarkbage
sebmarkbage / Enhance.js
Last active November 7, 2024 13:05
Higher-order Components
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {