Skip to content

Instantly share code, notes, and snippets.

View brunoksato's full-sized avatar
Focusing

Bruno Sato brunoksato

Focusing
View GitHub Profile
from time import sleep
from datetime import datetime
from binance.client import Client
from binance.helpers import date_to_milliseconds, interval_to_milliseconds
SECONDS_IN_MINUTE = 60
def _sample_crude_api_limiting(headers, threshold=1190, delay_buffer=5, weight_updates=False, sleep_updates=True, force_sleep=False):
if headers:
<?
# MIT license, do whatever you want with it
#
# This is my invoice.php page which I use to make invoices that customers want,
# with their address on it and which are easily printable. I love Stripe but
# their invoices and receipts were too wild for my customers on Remote OK
#
require_once(__DIR__.'/../vendor/autoload.php');
@tannerlinsley
tannerlinsley / createCrudHooks.js
Created November 29, 2020 06:39
A naive, but efficient starter to generate crud hooks for React Query
export default function createCrudHooks({
baseKey,
indexFn,
singleFn,
createFn,
updateFn,
deleteFn,
}) {
const useIndex = (config) => useQuery([baseKey], indexFn, config)
const useSingle = (id, config) =>
@julioxavierr
julioxavierr / useExpoResources.js
Last active February 27, 2020 13:03
React hook to abstract loading resources from expo and showing splash screen until completion
import { useEffect, useState } from 'react';
import * as Font from 'expo-font';
import { SplashScreen } from 'expo';
/**
* Load and use resources that need to be loaded async by Expo SDK
*/
const useExpoResources = () => {
const [isLoading, setIsLoading] = useState(true);
@arthurdenner
arthurdenner / generate-ios.sh
Last active January 3, 2020 17:21 — forked from monmonja/generate-ios.sh
generate ios from command line
# download this file to your project folder and excute
# chmod +x generate-ios.sh
# then run using
# ./generate-ios.sh
# flutter build defaults to --release
flutter build ios --no-codesign
# make folder, add .app then zip it and rename it to .ipa
mkdir -p Payload
@MRHarrison
MRHarrison / ERC20.sol
Last active September 10, 2020 15:34 — forked from giladHaimov/BasicERC20.sol
Basic ERC20 implementation
pragma solidity >=0.4.22 <0.6.0;
contract ERC20 {
// Balances
mapping(address => uint) tokenBalances;
// Allowances
mapping(address => mapping(address => uint)) tokenAllowances;
// The owner of this token
address public owner;
@steniowagner
steniowagner / Login.tsx
Last active January 13, 2022 04:20
Simple code to perform "swipe-actions" with flatlist in react-native
import React, { useState } from "react";
import LoginComponent from "./LoginComponent";
const usersTest = Array(8)
.fill({ name: "", cns: "" })
.map((_, index) => ({
name: `User ${index}`,
cns: `123.456.${index}`,
}));
@monmonja
monmonja / generate-ios.sh
Created July 16, 2019 13:16
generate ios from command line
# download this file to your project folder and excute
# chmod +x generate-ios.sh
# then run using
# ./generate-ios.sh
# flutter build defaults to --release
flutter build ios
# make folder, add .app then zip it and rename it to .ipa
mkdir -p Payload
@lucianomlima
lucianomlima / adb_connect.sh
Created June 5, 2019 17:57
Connect to Android devices with ADB through wi-fi
function adb_connect {
# PORT used to connect. Default: 5555
PORT=${1:-5555}
# IP address from current device connected
IP_ADDRESS=`adb shell ip route | awk '{print $9}'`
echo "ADB connect to $IP_ADDRESS on port $PORT"
# Change connection from usb to tcpip using $PORT
@sibelius
sibelius / usePrompt.tsx
Last active October 27, 2022 19:05
Prompt user before leaving route or reload
import { useEffect, useRef } from 'react';
import { useHistory } from 'react-router-dom';
export const usePrompt = (when: boolean, message: string = 'Are you sure you want to quit without saving your changes?') => {
const history = useHistory();
const self = useRef(null);
const onWindowOrTabClose = event => {
if (!when) {