Skip to content

Instantly share code, notes, and snippets.

Creating Black holes.

Pankaj Doharey metacritical

Creating Black holes.
View GitHub Profile
metacritical / LICENSE
Created Sep 16, 2021 — forked from mattyclarkson/LICENSE
Compile time Murmur3_32 implementation using C++11 constexpr
The MIT License (MIT)
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
metacritical / murmur3_constexpr.cpp
Created Sep 13, 2021 — forked from komiga/murmur3_constexpr.cpp
MurmurHash3 in C++11 using constexpr!
View murmur3_constexpr.cpp
#include <cstddef>
#include <cstdint>
#include <cstdio>
namespace util {
struct funcs;
template <typename S> struct mh3_internal;
template <typename S, S default_seed> struct mh3;
typedef mh3<uint32_t, 0> mh3_default;
metacritical / lisp.cpp
Created Sep 7, 2021 — forked from ofan/lisp.cpp
Lisp interpreter in 90 lines of C++
View lisp.cpp
Lisp interpreter in 90 lines of C++
I've enjoyed reading Peter Norvig's recent articles on Lisp. He implements a Scheme interpreter in 90 lines of Python in the first, and develops it further in the second.
Just for fun I wondered if I could write one in C++. My goals would be
1. A Lisp interpreter that would complete Peter's test cases correctly...
2. no more than 90 lines of C++.
Although I've been thinking about this for a few weeks, as I write this I have not written a line of the code. I'm pretty sure I will achieve 1, and 2 will be... a piece of cake!
metacritical / gist:f783f4e1159408eb0f821bfdfa42cb5b
Created Aug 19, 2021 — forked from zliuva/gist:1084476
A minimal Mach-o x64 executable for OS X
View gist:f783f4e1159408eb0f821bfdfa42cb5b
; A minimal Mach-o x64 executable for OS X (also see below Mountain Lion version)
; $ nasm -f bin -o tiny_hello tiny_hello.s
; $ chmod +x tiny_hello
; $ ./tiny_hello
; Hello World!
; $
; c.f.
; ( the original tiny mach-o executable )
metacritical / tiny_hello.asm
Created Aug 19, 2021 — forked from tilarids/tiny_hello.asm
A minimal Mach-o x32 executable for OS X El Capitan (with proper padding and symtable)
View tiny_hello.asm
; A minimal Mach-o x32 executable for OS X El Capitan (with proper padding and symtable)
; Original (pre 10.10.5) version -
; $ nasm -O0 -f bin -o tiny_hello tiny_hello.asm
; $ chmod +x tiny_hello
; $ ./tiny_hello
; (returns 42)
; $
; c.f.

Running processing without a screen

Let's say you want to run a Processing sketch on a server. Like maybe you want to generate several million PDF and JPEG images using a handful of Amazon EC2 instances.

This is called “headless” mode, and to do so, it's necessary to install what's known as a virtual frame buffer.

On Ubuntu 14.04, these are the things you need to install first:

sudo apt-get install xvfb libxrender1 libxtst6 libxi6 
View newest.json
"websiteId": "4f8b36d00000000000000001",
"date": "2019-04-01T00:00:00.000Z",
"chats": 121,
"missedChats": 0
"websiteId": "4f8b36d00000000000000002",
"date": "2019-04-01T00:00:00.000Z",
"chats": 13,

Tag Service

The simplest video tag service should have atleast four tables, a videos table, a tag lists table, a user table and a tags join table. We would prevent tag collisions through code.


User has many Editable tags, one user can see others tags. genreally this shouldnt be a problem but if one wants to search videos based on tags then redundaant tags would cause problems with indexing.

  • Assumption is that the tag service uses Sql Database, a no Sql Document design would defer form this design.
metacritical / System
Created Aug 6, 2021 — forked from vasanthk/System
System Design Cheatsheet
View System

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
metacritical / random_sentence.rb
Last active Jul 12, 2021
Create a text file with random sentences of a specific size in bytes.
View random_sentence.rb
#Create a random sentence file of spcified size.
#Usage : ruby sentence.rb 100000000 #In bytes.
words =' ')
maxsize = ARGV[0].to_i || 10000000000
current_size = 0
f ='testfile.txt', 'a')
char = %w(| / - \\).cycle
while current_size < maxsize