Skip to content

Instantly share code, notes, and snippets.

View pwener's full-sized avatar
📖
Learning...

Phelipe Wener pwener

📖
Learning...
View GitHub Profile
@jamesfulford
jamesfulford / useTime.js
Last active December 13, 2022 09:07
useTime() React hook
//
// useTime hook
//
import { useEffect, useState } from 'react';
export const useTime = (refreshCycle = 100) => {
// Returns the current time
// and queues re-renders every `refreshCycle` milliseconds (default: 100ms)
const [now, setNow] = useState(getTime());
@DeadNumbers
DeadNumbers / lz4_example.go
Created August 8, 2018 12:26
Golang example for compress file with LZ4
package main
import (
"bytes"
"fmt"
"io/ioutil"
"log"
"os"
"runtime"
"time"
@tozwierz
tozwierz / gist:76be651cc7a7d5c06ea290eec8a0ed73
Last active October 17, 2023 11:21
TDD: Socket.io + Jest Boilerplate
const io = require('socket.io-client');
const http = require('http');
const ioBack = require('socket.io');
let socket;
let httpServer;
let httpServerAddr;
let ioServer;
/**
@sammchardy
sammchardy / binance_get_historical_klines.py
Last active March 12, 2025 05:53
Get historical Klines from Binance
# uses the date_to_milliseconds and interval_to_milliseconds functions
# https://gist.github.com/sammchardy/3547cfab1faf78e385b3fcb83ad86395
# https://gist.github.com/sammchardy/fcbb2b836d1f694f39bddd569d1c16fe
from binance.client import Client
import time
def get_historical_klines(symbol, interval, start_str, end_str=None):
"""Get Historical Klines from Binance
@Geoff-Ford
Geoff-Ford / composing-software.md
Last active January 18, 2026 15:20
Eric Elliott's Composing Software Series

Eric Elliott's "Composing Software" Series

A collection of links to the excellent "Composing Software" series of medium stories by Eric Elliott.

Edit: I see that each post in the series now has index, previous and next links. However, they don't follow a linear flow through all the articles with some pointing back to previous posts effectively locking you in a loop.

@Geoff-Ford
Geoff-Ford / master-javascript-interview.md
Last active December 23, 2025 17:03
Eric Elliott's Master the JavaScript Interview Series
@AtulKsol
AtulKsol / psql-error-fix.md
Last active September 30, 2025 18:28
Solution of psql: FATAL: Peer authentication failed for user “postgres” (or any user)

psql: FATAL: Peer authentication failed for user “postgres” (or any user)

The connection failed because by default psql connects over UNIX sockets using peer authentication, that requires the current UNIX user to have the same user name as psql. So you will have to create the UNIX user postgres and then login as postgres or use sudo -u postgres psql database-name for accessing the database (and psql should not ask for a password).

If you cannot or do not want to create the UNIX user, like if you just want to connect to your database for ad hoc queries, forcing a socket connection using psql --host=localhost --dbname=database-name --username=postgres (as pointed out by @meyerson answer) will solve your immediate problem.

But if you intend to force password authentication over Unix sockets instead of the peer method, try changing the following pg_hba.conf* line:

from

@sitkevij
sitkevij / FaaS-serverless-technologies.md
Last active January 2, 2018 19:00
Function as a Service (Faas) Serverless Technologies
@btroncone
btroncone / rxjs_operators_by_example.md
Last active March 9, 2026 12:54
RxJS 5 Operators By Example
@indiesquidge
indiesquidge / subdomain-localhost-rails-5.md
Created January 19, 2016 07:42
how to access subdomains locally with Rails 5

Subdomaining Localhost with Rails 5

I've been following this blog post on how to set up an api-only Rails 5 application. One of the sections talks about creating a subdomain for your api

Rails.application.routes.draw do
  constraints subdomain: "api" do
    scope module: "api" do