Skip to content

Instantly share code, notes, and snippets.

@xeptore
xeptore / launch.json
Created April 19, 2019 04:26
VSCode Next.js v8 debugging compounded configuration
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Next: Chrome",
"url": "http://localhost:3000",
"sourceMapPathOverrides": {
"webpack:///*": "${webRoot}/*"
@xeptore
xeptore / nginx_spa.conf
Created March 28, 2019 07:08
Nginx Single Page App Configuration
server {
# ...
root /var/www/your_app_directory;
# ...
location / {
try_files $uri /index.html;
}
@xeptore
xeptore / mongo-auth.md
Created March 27, 2019 02:34
enabling mongodb authentication

Enabling Authentication on MongoDB

Securing

  1. Execute following queries in Mongo Shell:
use admin;
db.createUser({
  user: 'some username for admin',
  pwd: 'a super secure password for administraton, e.g. 123',
 roles: [ { role: "userAdminAnyDatabase", db: "admin" } ]
@xeptore
xeptore / xeptore.com.conf
Created March 27, 2019 02:21
nginx reverse named proxy configuration with custom headers
server {
listen 80;
server_name api.votak.xeptore.com;
location / {
proxy_set_header X-Forwarded-For $remote_addr;
proxy_pass http://127.0.0.1:9000;
}
}
@xeptore
xeptore / db.xeptore.ir
Created March 27, 2019 02:19
maradns example configuration
xeptore.ir. NS ns1.xeptore.ir. ~
xeptore.ir. NS ns2.xeptore.ir. ~
ns1.xeptore.ir. A 51.75.173.161 ~
ns2.xeptore.ir. A 51.75.173.161 ~
xeptore.ir. A 51.75.173.161 ~
www.xeptore.ir. CNAME xeptore.ir. ~
@xeptore
xeptore / example.com.conf
Created March 12, 2019 04:34
Ngnix port proxy configuration
server {
# from port 80
listen 80;
location / {
# to port 8000 on localhost
proxy_pass http://127.0.0.1:8000;
}
}
@xeptore
xeptore / db.createUser.js
Created March 12, 2019 04:18
add user to MongoDB
db.createUser({
user: "<name>",
pwd: "<cleartext password>",
customData: {},
roles: [
{ role: "<role>", db: "<database>" } | "<role>"
],
authenticationRestrictions: [
{
clientSource: ["<IP>" | "<CIDR range>"],
@xeptore
xeptore / fp.md
Last active April 21, 2020 22:54
my fp learning tips and quick recaps

FP Tips and Quick Recaps

Currying

const add = (x) => (y) => x + y;
const addTen = add(10);
const incerement = add(1)

console.log(addTen(4)); // 14
console.log(incremenet(5)); // 6
@xeptore
xeptore / fake_images.py
Created February 25, 2019 07:52
fake random image downloader using requests and Faker modules
from faker import Faker
import requests
import os
fake = Faker()
text = fake.text(1000)
image_urls = [
"".join((
@xeptore
xeptore / tables-list.sql
Created February 19, 2019 01:09
MS SQL Server List of Database Tables
SELECT TABLE_NAME FROM <DATABASE_NAME>.INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE';