Skip to content

Instantly share code, notes, and snippets.

View r1walz's full-sized avatar
:electron:
Building Something BIG

Rohit Ashiwal r1walz

:electron:
Building Something BIG
View GitHub Profile
@r1walz
r1walz / my_gzip.c
Last active February 14, 2019 21:29
file that can compress any string using zlib compression library
#include "zlib.h"
#include <stdio.h>
#if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(__CYGWIN__)
# include <fcntl.h>
# include <io.h>
# ifdef UNDER_CE
# include <stdlib.h>
# endif
# define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY)
@r1walz
r1walz / gdb.txt
Created March 17, 2019 14:23
GDB cheat sheet
GDB commands by function - simple guide
---------------------------------------
More important commands have a (*) by them.
Startup
% gdb -help print startup help, show switches
*% gdb object normal debug
*% gdb object core core debug (must specify core file)
%% gdb object pid attach to running process
% gdb use file command to load object
@r1walz
r1walz / keybase.md
Created March 18, 2019 13:41
My keybase identity

Keybase proof

I hereby claim:

  • I am r1walz on github.
  • I am r1walz (https://keybase.io/r1walz) on keybase.
  • I have a public key whose fingerprint is A84E 633A 0DEF 1480 4659 1DA0 DB58 9B5D 3130 9E1E

To claim this, I am signing this object:

@r1walz
r1walz / test.sh
Created March 19, 2019 16:13
Setup file to test `git diff --ignore-whitespace -p`
#!/bin/bash
if ! test -d /tmp/tmp
then
mkdir -p /tmp/tmp
else
rm -rf /tmp/tmp
mkdir /tmp/tmp
fi
@r1walz
r1walz / config.mak
Last active May 31, 2019 12:59
config.mak file for Building and Testing Git
O = 0
CFLAGS = -O$(O) -g $(EXTRA_CFLAGS) -Wall
DEVELOPER = 1
DEVOPTS = pedantic
THREADED_DELTA_SEARCH = 1
NO_SVN_TESTS = 1
TMP := /tmp/git-tests-$(shell git rev-parse --show-toplevel | sha1sum | head -c10)
GIT_TEST_OPTS = --root=$(TMP) -q --tee
GIT_PROVE_OPTS = --timer -j8 --state=failed,slow,save
DEFAULT_TEST_TARGET = prove
@r1walz
r1walz / cmds.sh
Created June 25, 2019 08:30
Setup to check the workings of apply's ignore-whitespace
# already on master
$ git apply patch2.patch --ignore-whitespace
@r1walz
r1walz / template.cpp
Last active December 11, 2019 18:16
My competitive programming template
#include <bits/stdc++.h>
using namespace std;
#define FAST_IO() do { \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL); \
} while (0);
#define start_routine() int begtime = clock();
#define end_routine() do { \
@r1walz
r1walz / simd.cpp
Last active March 12, 2020 10:35
A simple program crafted using the power of SIMD programming: $ g++ -O0 simd.cpp -o main && ./main
#include <cmath>
#include <cfloat>
#include <iostream>
#include <xmmintrin.h>
#define start_routine() int begtime = clock();
#define end_routine() do { \
int endtime = clock(); \
std::cerr << "\n" << "Time elapsed: " \
#!/bin/bash
CC=
TMP=0
MAX=0
ARCH=$(uname -m)
greater () {
return $(awk -v a=$1 -v b=$2 'BEGIN { printf "%d", (a > b ? 1 : 0) }')
}
@r1walz
r1walz / _experiment.md
Last active May 5, 2020 18:33
A quantum experiment to challenge our classical understandings!

A Quantum Experiment

Here is an experiment that can't be described by our natural (classical)
senses!

Suppose we have an experiment setup consisting of a photon source, a beam
splitter (which was once implemented using a half-silvered mirror), and a
pair of photon detectors. Have a look at the figure!

initial setup