Skip to content

Instantly share code, notes, and snippets.

docker run -d \
--name postgres \
-p 5432:5432 \
-e POSTGRES_PASSWORD=password \
-e POSTGRES_USER=postgres \
-e POSTGRES_DB=postgres \
-v postgresql_data=/var/lib/postgresql/data \
postgres
sudo -u postgres psql -U postgres -d postgres -c "UPDATE \"user\" SET \"password\" = 'test' WHERE \"name\" = 'admin'"
@extrimua
extrimua / deepFreeze.js
Last active September 1, 2021 14:30
deepFreeze
const deepFreeze = obj => {
Object.keys(obj).forEach(prop => {
if (typeof obj[prop] === 'object') deepFreeze(obj[prop]);
});
return Object.freeze(obj);
};
@extrimua
extrimua / hrtime.js
Created July 30, 2021 12:33
Execution Timer
const hrstart = process.hrtime()
//some code which takes time
const hrend = process.hrtime(hrstart)
console.info("Execution time (hr): %ds %dms", hrend[0], hrend[1] / 1000000);
@extrimua
extrimua / util-inherits
Created July 28, 2021 14:29
Node.js Inherits
// Inherits Prototype
util.inherits(Constructor, SuperConstructor)
// Inherits Instance
Object.assign(new Constructor(), new SuperConstructor())
@extrimua
extrimua / fedora-31-install-webstorm.md
Created July 22, 2021 09:57 — forked from siamkreative/fedora-31-install-webstorm.md
Installing WebStorm on Fedora 31
@extrimua
extrimua / docker.svg
Last active August 18, 2021 07:47
Base64
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
// Model
import { User } from '../models/User.js'
// Repository
import { UserRepositoryInterface } from '../../../../domain/contracts/repository/UserRepositoryInterface.js'
export class UserRepository extends UserRepositoryInterface {
async create({ id, auth, name, photo }){
@extrimua
extrimua / nginx.conf
Created April 23, 2021 11:10 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048