Skip to content

Instantly share code, notes, and snippets.

Avatar
Creating Black holes.

Pankaj Doharey metacritical

Creating Black holes.
View GitHub Profile
@metacritical
metacritical / doom.txt
Created Jan 11, 2022 — forked from hjertnes/doom.txt
Doom Emacs Cheatsheet
View doom.txt
SPC
SPC: find file
, switch buffer
. browse files
: MX
; EX
< switch buffer
` eval
u universal arg
x pop up scratch
@metacritical
metacritical / X11FullscreenHelper.java
Created Jan 8, 2022 — forked from vkravets/X11FullscreenHelper.java
Java Full Screen window on Linux OSs using native X11 calling
View X11FullscreenHelper.java
package org.linux.X11;
import com.sun.jna.Native;
import com.sun.jna.NativeLong;
import com.sun.jna.platform.unix.X11;
import java.awt.*;
/**
* Author: Vladimir Kravets
@metacritical
metacritical / RSI_and_StochRSI.py
Created Jan 1, 2022 — forked from ultragtx/RSI_and_StochRSI.py
Functions that calculate RSI and StochRSI which give the same value as Trading View. I wrote these functions as RSI and StochRSI functions from TA-Lib give different values as TV.
View RSI_and_StochRSI.py
# calculating RSI (gives the same values as TradingView)
# https://stackoverflow.com/questions/20526414/relative-strength-index-in-python-pandas
def RSI(series, period=14):
delta = series.diff().dropna()
ups = delta * 0
downs = ups.copy()
ups[delta > 0] = delta[delta > 0]
downs[delta < 0] = -delta[delta < 0]
ups[ups.index[period-1]] = np.mean( ups[:period] ) #first value is sum of avg gains
@metacritical
metacritical / LICENSE
Created Sep 16, 2021 — forked from mattyclarkson/LICENSE
Compile time Murmur3_32 implementation using C++11 constexpr
View LICENSE
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
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
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 Lis.py test cases correctly...
2. ...in 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
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.
; http://osxbook.com/blog/2009/03/15/crafting-a-tiny-mach-o-executable/ ( the original tiny mach-o executable )
@metacritical
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 - https://gist.github.com/softboysxp/1084476
; $ nasm -O0 -f bin -o tiny_hello tiny_hello.asm
; $ chmod +x tiny_hello
; $ ./tiny_hello
; (returns 42)
; $
; c.f.
View headless-p5.md

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 
@metacritical
metacritical / System Design.md
Created Aug 6, 2021 — forked from vasanthk/System Design.md
System Design Cheatsheet
View System Design.md

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?