Skip to content

Instantly share code, notes, and snippets.

View ricpumanes's full-sized avatar

kebrot ricpumanes

View GitHub Profile
More recent resolution:
1. cd ~/../../etc (go to etc folder in WSL).
2. echo "[network]" | sudo tee wsl.conf (Create wsl.conf file and add the first line).
3. echo "generateResolvConf = false" | sudo tee -a wsl.conf (Append wsl.conf the next line).
4. wsl --terminate Debian (Terminate WSL in Windows cmd, in case is Ubuntu not Debian).
5. cd ~/../../etc (go to etc folder in WSL).
6. sudo rm -Rf resolv.conf (Delete the resolv.conf file).
7. In windows cmd, ps or terminal with the vpn connected do: Get-NetIPInterface or ipconfig /all for get the dns primary and
secondary.
@ricpumanes
ricpumanes / README.md
Created May 5, 2023 12:14 — forked from gibatronic/README.md
Node crypto.pbkdf2 example to securely store and check passwords.

password.js

Tiny Node.js module to securely hash and compare passwords using pbkdf2 with per password random salt.

Usage

To hash a password:

var password = require('./password');
@ricpumanes
ricpumanes / typeOfUsername.ts
Created November 3, 2021 11:50
typeOfUsername
function typeOfUsername( inputString:string) : string {
//Insert your code here
if (inputString.length > 25) return 'invalid';
const vowels: string[] = ['a', 'e', 'i', 'o', 'u'];
const numOfVowels = inputString.split('').filter((c) => vowels.includes(c)).length;
const numOfConstants = inputString.length - numOfVowels;
@ricpumanes
ricpumanes / introrx.md
Created December 18, 2018 14:23 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@ricpumanes
ricpumanes / debounced-redux-thunk-action.js
Created December 10, 2018 04:37 — forked from krstffr/debounced-redux-thunk-action.js
Debouncing redux thunk actions.
// A common redux pattern when dealing with async functions is to use thunk.
// This usually means your action returns a new function instead of an action object,
// and the thunk middleware will make it all work. Example:
const asyncAction = () => dispatch => setTimeout(() => dispatch(someOtherAction()), 10000);
// Now: maybe that async stuff going on is calling some API which you don't want to overload
// with request, and that's what debounce is for.
// This is an example of a debounced function which will only be calleable once every second.
import { debounce } from 'lodash';
const debouncedFn = debounce(() => callApi(), 1000, { leading: true, trailing: false });