Skip to content

Instantly share code, notes, and snippets.

@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)
@cTatu
cTatu / pump_detector.py
Created April 22, 2021 16:22
Binance coin pump detector
from collections import deque
from binance.websockets import BinanceSocketManager
from binance.client import Client
from binance.enums import *
from twisted.internet import reactor
coins = ['ACM', "ADX", "AERGO", "AGI", "AION", "AKRO", "ALPHA", "AMB", "APPC", "ARDR", "ARK", "ASR", "AST", "ATM", 'AUCTION', "AUDIO", "AVA", "AXS", "BADGER", "BCD", "BEAM", "BEL", "BLZ", "BQX", "BRD", "BTCST", "BTG", "BTS", "BZRX", "CAKE", "CDT", "CELO", "CKB", "CND", "COS", "CTK", "CTXC", "DATA", "DCR", "DEGO", "DIA", "DLT", "DNT", "DODO", "DREP", "DUSK", "EASY", "EGLD", "ELF", "EVX", "FIO", "FIRO", "FIS", "FLM", "FOR", "FRONT", "FUN", "FXS", "GAS", "GLM", "GO", "GRS", "GTO", "GVT", "HARD", "HNT", "IDEX", "INJ", "JUV", "KSM", "LIT", "LOOM", "LTO", "LUNA", "MDA", "MDT", "MITH", "MTH", "MTL", "NAS", "NAV", "NBS", "NEBL", "NKN", "NMR", "NXS", "OAX", "OCEAN", "OG", "ORN", "OST", "OXT", "PAXG", "PERL", "PHB", "PIVX", "PNT", "POA", "POLY", "POWR", "PPT", "PSG", "QKC", "QLC", "QSP", "RCN", "RDN", "REEF", "RENBTC", "REQ", "RIF", "ROSE",
@jojonas
jojonas / love2d-unpacker.py
Last active May 9, 2024 15:43
Love2d executable unpacker.
import argparse
import os, os.path
import zipfile
import io
def readui32(file):
bytes = file.read(4)
number = bytes[0]
number += bytes[1] << 8
number += bytes[2] << 16
@kidchemical
kidchemical / Movement.cs
Last active May 9, 2024 15:43
(Unity) Third Person Player Movement Script
/*
* Third Person Player Movement Script v1.1 by Ian McCambridge
* :: Free to use always <3 2020 ::
*
* This script pairs with my "Third Person Camera Script" which can be found here:
* https://gist.github.com/kidchemical/b1542ea489c8f2abae3fbd09798dedd4
* FEATURE OUTLINE:
* -Rigidbody required.
* -Plane or Ground must have Tag property set to new tag named "Ground"
* -Freeze X and Z Rotation for player Rigidbody
@i3visio
i3visio / hashcash.py
Created August 9, 2016 21:27
hashcash.py is a clean implementation of a "proof of work" library for Python.
# ----------------------------------------------
# hashcash.py: Hashcash implementation
# ----------------------------------------------
"""
Hashcash is a "proof of work."
Example:
>>> import sha
>>> sha.new('denmark2890CF').hexdigest() '000000cf89643370c24e413ec0886ab92bd7f6e8'