Skip to content

Instantly share code, notes, and snippets.

@jonmircha
jonmircha / helpHttp.js
Last active May 9, 2024 16:03
Script que te permite simplificar peticiones HTTP con Fetch, esta escrita en VanillaJS por lo que puedes usarla con cualquier framework o librería
export const helpHttp = () => {
const customFetch = (endpoint, options) => {
const defaultHeader = {
accept: "application/json",
};
const controller = new AbortController();
options.signal = controller.signal;
options.method = options.method || "GET";
@mtisz
mtisz / mixtral-8x22B.yaml
Created May 9, 2024 14:57
Axolotl Config for Mixtral-8x22B
base_model: mistral-community/Mixtral-8x22B-v0.1
model_type: MixtralForCausalLM
tokenizer_type: AutoTokenizer
is_mistral_derived_model: false
trust_remote_code: true
load_in_8bit: false
load_in_4bit: true
strict: false
@calexandre
calexandre / merge-zsh-history.sh
Last active May 9, 2024 15:56
Merge two zsh history files
#!/bin/bash
# Inspired on https://david-kerwick.github.io/2017-01-04-combining-zsh-history-files/
set -e
history1=$1
history2=$2
merged=$3
echo "Merging history files: $history1 + $history2"
test ! -f $history1 && echo "File $history1 not found" && exit 1
@muendelezaji
muendelezaji / bash-to-zsh-hist.py
Created October 5, 2016 14:18 — forked from op/bash-history-to-zsh-history.py
Convert Bash history to Zsh history
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This is how I used it:
# $ cat ~/.bash_history | python bash-to-zsh-hist.py >> ~/.zsh_history
import sys
import time
@csanz
csanz / to generate a human readable time range using ruby on rails
Created November 9, 2010 18:58
to generate a human readable time range using ruby on rails
def humanize secs
[[60, :seconds], [60, :minutes], [24, :hours], [1000, :days]].inject([]){ |s, (count, name)|
if secs > 0
secs, n = secs.divmod(count)
s.unshift "#{n.to_i} #{name}"
end
s
}.join(' ')
end
@qoomon
qoomon / conventional_commit_messages.md
Last active May 9, 2024 15:52
Conventional Commit Messages

Conventional Commit Messages

See how a minor change to your commit message style can make a difference.

Tip

Have a look at git-conventional-commits , a CLI util to ensure these conventions and generate verion and changelogs

Commit Message Formats

Default

@VagnerSilva
VagnerSilva / NativeBaseProvider.tsx
Created August 7, 2023 19:16
Fix to NativeBaseProvider.tsx - In React 18, SSRProvider is not necessary and is a noop.
import { OverlayProvider } from '@react-native-aria/overlays';
import { SSRProvider } from '@react-native-aria/utils';
import { ToastProvider, ToastRef, useToast } from 'native-base/src/components/composites/Toast';
import React from 'react';
import { Platform, useWindowDimensions } from 'react-native';
import {
Metrics,
SafeAreaProvider,
initialWindowMetrics as defaultInitialWindowMetrics,
} from 'react-native-safe-area-context';
@carlhoerberg
carlhoerberg / reconnect.js
Created May 13, 2015 14:45
How to build reconnect logic for amqplib
var amqp = require('amqplib/callback_api');
// if the connection is closed or fails to be established at all, we will reconnect
var amqpConn = null;
function start() {
amqp.connect(process.env.CLOUDAMQP_URL + "?heartbeat=60", function(err, conn) {
if (err) {
console.error("[AMQP]", err.message);
return setTimeout(start, 1000);
}
@kennwhite
kennwhite / 1944_OSS_Simple_Sabotage_Field_Manual.md
Last active May 9, 2024 15:44
1944 OSS Simple Sabotage Field Manual
@vinooniv
vinooniv / orb_flann_matcher.py
Created January 9, 2020 13:46
ORB FLANN based matcher
import argparse
import cv2
import numpy as np
def get_corrected_img(img1, img2):
MIN_MATCHES = 50
orb = cv2.ORB_create(nfeatures=500)