Skip to content

Instantly share code, notes, and snippets.

View nitingupta910's full-sized avatar

Nitin Gupta nitingupta910

View GitHub Profile
#!/usr/bin/env bash
Z=$(curl -s https://ziglang.org/download/index.json | jq -r '.master."x86_64-linux".tarball')
OUT_DIR=$(echo "$Z" | awk -F "/" '{ print $NF }' | sed 's/.tar.xz//')
if [ -d "$OUT_DIR" ]; then
echo "Latest Zig already present: $OUT_DIR"
else
curl -s "$Z" | tar xJf -
fi
#!/usr/bin/env bash
##
# git-diffc: Graphical Git diff viewer
# 'c' -> comprehensive :)
# Author: Nitin Gupta <nitin@nitingupta.dev>
# Last Modified (mm-dd-yy): 03/11/2020
#
##
@nitingupta910
nitingupta910 / Installing BCC and bpftrace from source on Ubuntu 18.04.md
Last active October 8, 2023 08:46
Installing BCC and bpftrace from source on Ubuntu 18.04

Steps to install BCC and bpftrace from source on Ubuntu 18.04.

BCC

Install build dependencies

sudo apt-get -y install bison build-essential cmake flex git libedit-dev \
  libllvm6.0 llvm-6.0-dev libclang-6.0-dev python zlib1g-dev libelf-dev \
 iperf3 luajit libluajit-5.1-dev netperf linux-headers-$(uname -r)

my laptop:

I'm writing this here because a view things in here are spesific to this model laptop.
Dell XPS 15 9560 (4k) touch screen

Some notes:

Most things after setup are not specific for this laptop
# = run as root
$ = run as normal user (you)

Install and On first boot

@nitingupta910
nitingupta910 / font-el7.sh
Created May 3, 2018 19:11
installs better than cleartype font rendering on rhel/centos 7
#!/usr/bin/bash
set -e
# set up nux-dextop repo to install font packages. skip if this repo had already set up.
# can be done by either rpm or yum app.
# /usr/bin/sudo /usr/bin/rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
/usr/bin/sudo /usr/bin/yum localinstall http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
# disable nux-dextop by default and only enable it as needed as part of running yum.
@nitingupta910
nitingupta910 / thp_usage.c
Last active December 16, 2017 06:54
thp bloat
#define _GNU_SOURCE
#include <error.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/types.h>
@nitingupta910
nitingupta910 / _readme.md
Created March 15, 2016 18:39 — forked from lambdahands/_readme.md
FlowType and CSS Modules

Huh?

So basically FlowType doesn't know about CSS Modules, a really handy way of dealing with the plagues of CSS in codebases (global variables and dependency wackiness mainly).

What WebPack allows us to do is "require" CSS files and use their class names:

import styles from "my_styles.css";
import React from "react";
@nitingupta910
nitingupta910 / rdb_mergeop.c
Created April 4, 2015 18:53
Using rocksdb merge operator in C
/*
Makefile:
(make sure Makefile is indented using a tab and not spaces)
all:
cc -Wall -g -O0 rdb_mergeop.c -o rdb_mergeop -lstdc++ -lrocksdb -lsnappy -lbz2 -llz4 -lz
clean:
rm -rf rdb_mergeop
rm -rf testdb
*/
@nitingupta910
nitingupta910 / main.c
Last active July 15, 2023 02:58 — forked from crosbymichael/main.c
rocksdb C example
/*
Makefile:
(make sure Makefile is indented using a tab and not spaces)
all:
cc -Wall -g -O0 rdb_mergeop.c -o rdb_mergeop -lstdc++ -lrocksdb -lsnappy -lbz2 -llz4 -lz
clean:
rm -rf rdb_mergeop
rm -rf testdb
*/