Skip to content

Instantly share code, notes, and snippets.

View daniel-vera-g's full-sized avatar
💭
Present

Daniel VG daniel-vera-g

💭
Present
View GitHub Profile
@daniel-vera-g
daniel-vera-g / import-postgres-dump.md
Created January 3, 2024 11:02
import-postgres-dump
  1. (Optional) Create Database: createdb -U musicbrainz musicbrainz
  2. Create Schema in your Table: CREATE SCHEMA musicbrainz;
  3. Import Schema(There are some errors...let's ignore them): psql -U musicbrainz -d musicbrainz -f schema_dump.sql
  4. Import actual dump(Takes a while): psql -U musicbrainz -d musicbrainz -f dump.sql
  5. (Optional) Connect to DB & check data:
  • psql -U musicbrainz -d musicbrainz
  • Something like:
musicbrainz=# select name from artist limit 10;

Install Spark on Mac

Install Homebrew(Package manager):

  • /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  • brew upgrade && brew update

If not installed, install:

  1. Java:
#!/bin/bash
# Clean up temporary latex files
# Requires fd-find dependency
FilesToClean=("aux" "bbl" "blg" "fdb_latexmk" "fls" "log" "out" "pdf" "acn" "glo" "ist" "toc")
for file in ${FilesToClean[@]}; do
echo "Cleaning up ${file} files.."
fd -e $file --no-ignore -x rm {}
@daniel-vera-g
daniel-vera-g / update-branches-tags.sh
Last active April 7, 2021 13:17
Sync all branches and tags with new remote
#!/bin/bash
# To be used with: https://gist.github.com/daniel-vera-g/fcecac7103cae23ddfc80306d22fa7f0
# Sync all branches and tags with new remote
# Credits: https://gist.github.com/tamtamchik/2869690/
# Fetch all branches and tags
fetchAll() {
for branch in `git branch -r | grep -v HEAD | grep -v master`; do
@daniel-vera-g
daniel-vera-g / gitlab-migration.sh
Last active April 7, 2021 13:18
Migrate multiple repositories from github to gitlab
#!/bin/bash
# To be used with: https://gist.github.com/daniel-vera-g/dc4df64ed1064406c8956f588c538d41
# Migrate multiple repositories from github to gitlab
# Name of repos to migrate
reposToMigrate=('')
# Name of gitlab domain

Project Title

One Paragraph of project description goes here

Usage

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites (Optional)

Commit messages

Commit Message Format

Each commit message consists of a header, a body and a footer. The header has a special format that includes a type, a scope and a subject:

<type>(<scope>): <subject>
<BLANK LINE>
@daniel-vera-g
daniel-vera-g / update-markdown-toc.sh
Created October 25, 2020 14:36
Update Markdown table of contents using markdown-toc npm package and linux utilities
#!/bin/sh
# Remove current toc:
# 1. Use sed to remove everything till the first heading
# 2. Write it to tmp file
# 3. When no errors merge it with index file
sed -n '/^#/,$p' index.md > tmp \
&& yes | mv tmp index.md
# Create table of contents:
@daniel-vera-g
daniel-vera-g / c-pointer-fun.c
Last active April 10, 2020 19:48
c pointers explained.
#include <stdio.h>
int main() {
int* p;
// Address pointer is pointing to
printf("Address pointer p is pointing to: %p\n", p);
// Address of pointer itself
printf("Address of pointer p itself: %p\n", &p);
int x = 3;
@daniel-vera-g
daniel-vera-g / flutter_starter.dart
Created May 16, 2019 18:15
Heavily documented flutter starter app boilerplate.
import 'package:flutter/material.dart';
import 'package:english_words/english_words.dart';
// Arrow functions for one line functions
void main() => runApp(MyApp());
// Makes App itself widget -> Nearly everything is widget(alignment, padding & layout)
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {