Skip to content

Instantly share code, notes, and snippets.

View halivert's full-sized avatar
🦏
Rushing like a rhino

Halí V. halivert

🦏
Rushing like a rhino
View GitHub Profile
@halivert
halivert / .vimrc
Last active January 5, 2018 05:00
Linux vimrc
set nocompatible
so ~/.vim/plugins.vim
set showcmd
set rnu
syntax on
let mapleader = ','
set path+=**
@halivert
halivert / copyIcons.sh
Created September 21, 2018 06:25
Iconos para iOS
if [ $# -eq 0 ]
then
echo "No arguments"
exit
fi
for file in "$@"
do
fullFileName=$file
extension="${fullFileName##*.}"
@halivert
halivert / exhibidores
Created November 25, 2018 18:35
Script that converts pdf to jpg and copy the pdf to an usb
#! /bin/zsh
setopt +o nomatch
RED='\033[0;31m'
NC='\033[0m'
PDFinDownloads=$(ls ~/Descargas/Exhibidores*.pdf -t 2>/dev/null | head -1)
mv $PDFinDownloads . 2>/dev/null
if [ $? -ne 0 ]; then
echo "${RED}There's no Exhibidor files in Descargas"
fi
@halivert
halivert / app.py
Created January 24, 2019 05:51
Flask minimal API
from flask import (Flask)
from flask_restplus import (Api)
import resources
app = Flask(__name__)
api = Api(app, prefix='/v1', catch_all_404s=True)
api.add_resource(resources.TasksList, '/tasks')
@halivert
halivert / BField.vue
Last active November 16, 2019 07:46
Field to use with Bulma
<script>
export default {
name: "b-field",
inheritAttrs: false,
props: {
coverErrors: Boolean,
errors: {
type: Array,
default: function() {
return [];
@halivert
halivert / HSelect.vue
Last active November 16, 2019 07:47
Select for use with Vue.js
<template>
<div>
<select v-bind="$attrs" v-model="selectedId" v-on="selectListeners">
<option
v-if="$attrs.placeholder"
:value="placeholderId"
:disabled="!enablePlaceholder"
>
{{ $attrs.placeholder }}
</option>
@halivert
halivert / hali.sh
Last active June 16, 2020 19:30
CentOS 8 Initial setup
#! /bin/sh
sudo dnf install nginx mariadb-server -y
sudo dnf install dnf-utils http://rpms.remirepo.net/enterprise/remi-release-8.rpm
sudo dnf module reset php
sudo dnf module enable php:remi-7.4
sudo dnf install php-fpm php-mysqli -y
sudo systemctl start nginx mariadb
sudo systemctl enable nginx mariadb
@halivert
halivert / intToBin.c
Last active April 11, 2021 17:14
C utilities
#include <stdlib.h>
char *intToBin(int num) {
int bits = (num == 0);
int cp = num;
for (cp = num; cp > 0; cp >>= 1) bits++;
char *result = (char *)malloc(bits * sizeof(char));
@halivert
halivert / miniTest.sh
Created April 10, 2021 06:11
Mini test framework (Tests programs with single input (stdin) and single output (stdout))
EXEC="./$1"
function test() {
if [ "$1" $2 "$3" ]; then
echo -e "\e[32mPASS\e[0m"
else
echo -e "\e[31mNOT PASS - $1 $4 $3 \e[0m"
fi
}
@halivert
halivert / splitIn.js
Created August 22, 2021 18:41
Split in groups a JS array
const splitIn = (elements, groups) => {
return elements.reduce((result, val, _, elements) => {
let lastItem = result[result.length - 1];
if (lastItem.length === Math.ceil(elements.length / groups)) result.push([val]);
else lastItem.push(val);
return result;
}, [[]]);
}