Skip to content

Instantly share code, notes, and snippets.

View filevich's full-sized avatar
🥜
deez nuts

JP Filevich filevich

🥜
deez nuts
View GitHub Profile
@filevich
filevich / git-secure-credential-store.md
Last active August 31, 2022 22:13
git secure credential store

sudo apt install libsecret-1-0 libsecret-1-dev

cd /usr/share/doc/git/contrib/credential/libsecret

sudo make

git config --global credential.helper /usr/share/doc/git/contrib/credential/libsecret/git-credential-libsecret

When you git clone, git fetch, git pull, or git push to a remote repository using HTTPS URLs on the command line, Git will ask for your GitHub username and password. When Git prompts you for your password, enter your personal access token (PAT).

@filevich
filevich / sample.md
Last active October 4, 2021 01:35
REPL nodejs javascript

> .load foo.js

or

node -i -e "$(< yourScript.js)"

@filevich
filevich / golang-json-benchmark_test.go
Last active January 30, 2022 13:01
golang json slice benchmark
package main
import (
"bytes"
"encoding/json"
"fmt"
"testing"
)
/*
@filevich
filevich / combs.py
Last active March 6, 2022 16:32
all possible combinations and subsets of a given array
def cross(h, xs):
return [[h]+x for x in xs]
def combs(xs, n):
if n == 1:
return [[x] for x in xs]
res = []
head = xs[:-n + 1]
@filevich
filevich / static ip
Created April 11, 2022 21:14
linux guide
# interfaces(5) file used by ifup(8) and ifdown(8)
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d
# replace enp1s0 with your link according to: `$ip -c link show`
auto enp1s0
iface enp1s0 inet static
address 192.168.1.8
netmask 255.255.255.0
import { useState, useEffect, useRef, useMemo } from 'react';
export const useQuery = () => {
const abortCtrl = useMemo(() => new AbortController(), [])
// a priori
, url = useRef("")
, opt = useRef({})
const [res, setRes] = useState(null)
, [err, setErr] = useState(null)
@filevich
filevich / linux-tips.md
Last active October 4, 2024 13:25
linux tips

distro name

lsb_release -a or cat /etc/lsb-release

simple time

/usr/bin/time -f 'TIME:%e RAM:%M\n' go run cmd/dmc/*.go

quick bench cmd alias

@filevich
filevich / progress.py
Last active September 21, 2022 00:21
simple progress print python
def progress(it,every,total):
r = (it+1) % delta == 0
p = ((it+1) / total) * 100
if r: print(f"{p:.0f}%");
for i in range(1_000_000):
progress(
it=i,
every=len(data)/10,
total=len(data))
@filevich
filevich / linux-essentials.md
Last active August 26, 2024 16:39
linux install essentials

Gnome config

  • Appearance > Auto-hide the Dock: on
  • Appearance > Icon size: 20
  • Search > Files + Characters: off
  • Sound > Over-Amplification on
  • Power > Auto brightness: off
@filevich
filevich / delta
Created November 22, 2022 23:44
python time delta
from datetime import datetime, timedelta
tic = datetime.now()
# do domething
d = (datetime.now() - tic) / timedelta(hours=1)
fmt_dur = lambda d: "{}".format(d)[:-7]