Skip to content

Instantly share code, notes, and snippets.

View Harold2017's full-sized avatar
😃

Harold Harold2017

😃
View GitHub Profile
@Harold2017
Harold2017 / Go_Memory.md
Last active September 17, 2021 13:13
Golang memory study

Notes

Memory in general

size class 67 types class 0 is for large object

@Harold2017
Harold2017 / opencv_setup.sh
Created July 9, 2019 03:18 — forked from Mahedi-61/installing_opencv_from_source_in_Ubuntu_1804.sh
Installing OpenCV from source on Ubuntu 18.04 machine
#!/bin/bash
# This gist is a step by step instructions to build and install OpenCV from source on ubuntu 16.04 LTS
# note: The easy and quick way to install is
# sudo pip3 install opencv-python
# sudo pip3 install opencv-contrib-python
# But this easy pypi installation can’t open video files on GNU/Linux distribution or on mac OS X system.
# And on some system opencv binaries provided packages are not compiled.
# Therefor we have no way rather than build it from source.
@Harold2017
Harold2017 / cov_mat.md
Last active July 18, 2019 04:47
Correct way to calculate covariance matrix

Covariance Matrix Calculation

homemade cov function for 3d points:

#include "iostream"
#include "arrayfire.h"
@Harold2017
Harold2017 / Storing-Images-On-Github.md
Created August 9, 2019 05:16 — forked from joncardasis/Storing-Images-On-Github.md
Storing Images and Demos in your Repo

Storing Images and Demos in your Repo

In this quick walkthough you'll learn how to create a separate branch in your repo to house your screenshots and demo gifs for use in your master's readme.

How to

1. Clone a fresh copy of your repo

In order to prevent any loss of work it is best to clone the repo in a separate location to complete this task.

2. Create a new branch

Create a new branch in your repo by using git checkout --orphan assets

@Harold2017
Harold2017 / Octave.md
Created September 10, 2019 04:31
Install Octave on Ubuntu 18.04

Install Octave with flatpak

  • Install flatpak sudo apt-get install flatpak
  • Add flathub flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
  • Install Octave flatpak install flathub org.octave.Octave
@Harold2017
Harold2017 / github_actions_golang.md
Created September 16, 2019 09:56
github actions golang, build, test, codecov

build

name: build
on: [push]
jobs:

  build:
    name: Build
    runs-on: ubuntu-latest
@Harold2017
Harold2017 / buildInfo.md
Created November 1, 2019 10:14
add build info to go binary
package version

// reference: https://stackoverflow.com/questions/11354518/application-auto-build-versioning

import (
	"fmt"
	"runtime"
	"strings"
)
@Harold2017
Harold2017 / simpleShell.go
Created November 4, 2019 07:41
simple shell in golang
package main
import (
"bufio"
"fmt"
"os"
"os/exec"
"strings"
)
@Harold2017
Harold2017 / bits.go
Created November 12, 2019 12:48
bit operation in golang
package bits
// from `strconv.Iota`
const host32bit = ^uint(0)>>32 == 0
const host64bit = ^uint(0)>>64 == 0
const intSize = 32 << (^uint(0) >> 63)
const shiftToSign = intSize - 1
// Sign returns 1 for positive, -1 for negative and 0 for 0
func Sign(x int) int {