Skip to content

Instantly share code, notes, and snippets.

View abidanBrito's full-sized avatar

Abidán Brito abidanBrito

View GitHub Profile

Conda Cheatsheet

Set up

Installing miniconda

Linux / WSL

curl -LO https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh

Windows

# Install minimal prerequisites (Ubuntu 18.04 as reference)
sudo apt update && sudo apt install -y cmake g++ wget unzip
# Download and unpack sources
wget -O opencv.zip https://github.com/opencv/opencv/archive/4.x.zip
unzip opencv.zip
# Create build directory
mkdir -p build && cd build

GIT CHEATSHEET

Basic Concepts

  • Distributed Version Control System.
  • Working Directory.
  • Staging Area.
  • Local Repository.
  • Remote Repository.
  • Origin.
  • Upstream.
@abidanBrito
abidanBrito / build-emacs.sh
Last active November 20, 2024 03:17
Build GNU Emacs from source.
#!/usr/bin/env bash
## Author: Abidán Brito
## This script builds GNU Emacs 29.1 with support for native elisp compilation,
## tree-sitter, libjansson (C JSON library), pure GTK and mailutils.
# Exit on error and print out commands before executing them.
set -euxo pipefail
# Let's set the number of jobs to something reasonable; keep 2 cores
/////////////////////////////////////
// APPROACH #1
/////////////////////////////////////
// In the Fragment
val textView: TextView = activity!!.findViewById(R.id.custom_toolbar_title) as TextView
viewModel.fragmentName.observe(viewLifecycleOwner, {
textView.text = it
})
/////////////////////////////////////

I sometimes run into issues when setting up a local repo because of the new main default branch name on GitHub. Let's rename the local branch and set its upstream properly.

git branch -m master main
git fetch origin
git branch -u origin/main main
git remote set-head origin -a

NOTE: git remote set-head origin -a fetches and sets origin/HEAD, so that the local repository has a local reference of what the remote repository considers to be the default branch.

StringBuilder jsonData = new StringBuilder();
jsonData.Append("[");
for (int i = 0; i < dt.Rows.Count; ++i)
{
jsonData.Append("{");
jsonData.Append("\"" + "DNI" + "\":" + "\"" + dt.Rows[i][0] + "\"" + "," + "\"" + "Name" + "\":" + "\"" + dt.Rows[i][1] + "\"" + ",");
jsonData.Append("\"" + "Telephone" + "\":" + "\"" + dt.Rows[i][2] + "\"" + "," + "\"" + "Observations" + "\":" + "\"" + dt.Rows[i][3] + "\"");
if (i == dt.Rows.Count - 1) { jsonData.Append("}"); }
else { jsonData.Append("},"); }