This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function constants() { | |
const data = { | |
T: { // levha kalınlıkları | |
single: 3, | |
double: 5 | |
}, | |
tCostFactor: { // levha maliyetleri | |
single: 5.5, | |
double: 8.5 | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {execSync} from 'child_process' | |
const service = 'some_service' | |
const containerId = execSync(`docker ps -f name=${service} --quiet`).toString().trim() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SAMPLE_DIR=/mnt/some-volume | |
# change ownership of the directory and all of its contents | |
chown -R cmsman:cmsteam $SAMPLE_DIR | |
# change permissions of the directory and all of its contents | |
chmod -R u=rwX,g=rwX,o-rwx $SAMPLE_DIR | |
# set uid and gid | |
chmod -R u+s $SAMPLE_DIR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
openssl genrsa -out cms_auth_key.pem 4096 | |
openssl rsa -in cms_auth_key.pem -outform PEM -pubout -out cms_auth_key_public.pem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* | |
* Purformance | |
* | |
* Simply use mark and measure methods similar to native performance api. | |
* | |
* Native performance methods are not supported by browsers | |
* and there is no better way to measure performance than Date.getTime() | |
* in those cases. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function configureTimeAgo(element) { | |
const elementID = element.getAttribute('id') | |
let updater = setInterval(function() { | |
const elementStillExistInDOM = document.getElementById(elementID) | |
if (!elementStillExistInDOM) { | |
clearInterval(updater) | |
return; | |
} | |
const seconds = (Date.now() - parseFloat(element.dataset.timestamp)) / 1000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# set env vars from .env file | |
set -a | |
. $1 | |
set +a | |
# set backup filename | |
datetime=$(date +%Y-%m-%d-%H-%M-%S) | |
filename="${datetime}.gz" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mongodb://$user:$password@localhost:27027/?authMechanism=DEFAULT&authSource=$dbname | |
mongodb://$user:$password@$host1:27017,$host2:27017/?replicaSet=rs0&authMechanism=DEFAULT&authSource=$dbname |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# check if user doesn't exist | |
function user_doesnt_exist { | |
if id -u "$1" >/dev/null 2>&1; then | |
return 1 | |
else | |
return 0 | |
fi | |
} | |
# usage. do something if the user abc doesn't exist. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const os = require('os') | |
const crypto = require('crypto') | |
const path = require('path') | |
const fs = require('fs') | |
const util = require('util') | |
const puppeteer = require('puppeteer') | |
const libxml = require('libxmljs') | |
const dayjs = require('dayjs') | |
// generates static html files for server side rendering |
NewerOlder