Skip to content

Instantly share code, notes, and snippets.

Avatar
👨‍💻
I may be slow to respond.

Zohaib Rauf zabirauf

👨‍💻
I may be slow to respond.
View GitHub Profile
@zabirauf
zabirauf / gopro-clip-mount.stl
Created January 8, 2023 23:59
GoPro mount that clips on one side and has the connector on other
View gopro-clip-mount.stl
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@zabirauf
zabirauf / expng.ex
Created July 23, 2015 08:32
PNG format Parser in Elixir
View expng.ex
defmodule Expng do
defstruct [:width, :height, :bit_depth, :color_type, :compression, :filter, :interlace, :chunks]
def png_parse(<<
0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A,
_length :: size(32),
"IHDR",
width :: size(32),
height :: size(32),
@zabirauf
zabirauf / init.vim
Last active February 16, 2022 21:01
Neovim configuration
View init.vim
call plug#begin()
" Autocompletion
Plug 'roxma/nvim-completion-manager'
Plug 'Valloric/YouCompleteMe', { 'do': './install.py --clang-completer --racer-completer --omnisharp-completer --tern-completer' }
Plug 'ervandew/supertab'
Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'
" Buffer
@zabirauf
zabirauf / qc_for_cs_notebook.jl
Created January 10, 2021 06:43
Quantum computing for computer scientist - Julia notebook
View qc_for_cs_notebook.jl
### A Pluto.jl notebook ###
# v0.12.18
using Markdown
using InteractiveUtils
# ╔═╡ 72d474ec-4327-11eb-26d0-072a3be1e84f
begin
using Pkg
@zabirauf
zabirauf / qc_for_cs_notebook.html
Created January 10, 2021 06:06
Julia notebook for "Quantum computing for Computer scientist"
View qc_for_cs_notebook.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width" />
<title>⚡ Pluto.jl ⚡</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/fonsp/Pluto.jl@0.12.17/frontend/editor.css" type="text/css" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/fonsp/Pluto.jl@0.12.17/frontend/treeview.css" type="text/css" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/fonsp/Pluto.jl@0.12.17/frontend/hide-ui.css" type="text/css" />
@zabirauf
zabirauf / ROP.ex
Created March 26, 2015 07:48
Railway Oriented Programming macros in Elixir
View ROP.ex
defmodule ROP do
defmacro try_catch(args, func) do
quote do
(fn ->
try do
unquote(args) |> unquote(func)
rescue
e -> {:error, e}
end
@zabirauf
zabirauf / curry.ts
Created January 3, 2019 04:53
Strongly typed currying in Typescript
View curry.ts
type Func = (...args: any[]) => any;
type FirstParam<T extends Func> =
T extends (arg: infer J, ...args: infer U) => infer V
? J
: never;
type TailParams<T extends Func> =
T extends (arg: infer J, ...args: infer U) => infer V
? U
@zabirauf
zabirauf / renew-mongo-cert.sh
Last active May 22, 2019 11:36
Renew certificate using certbot for MongoDB
View renew-mongo-cert.sh
#!/bin/bash
# Define variables
DOMAIN=foo.example.com
# renew cert
certbot renew
# combine latest letsencrypt files for mongo
View GlobalCalculator_V2.sol
pragma solidity ^0.4.21;
import './GlobalCalculator.sol';
contract GlobalCalculator_V2 is GlobalCalculator_V1 {
function getMul() public view returns (uint mul) {
mul = 1;
for (uint i = 0;i < _nums.length; i++) {
mul *= _nums[i];
View GlobalCalculator_V1.sol
pragma solidity ^0.4.21;
contract GlobalCalculator_V1 {
uint[] internal _nums;
function addNum(uint x) public {
_nums.push(x);
}
function getSum() public view returns (uint sum) {