Skip to content

Instantly share code, notes, and snippets.

View sshaplygin's full-sized avatar
🎯
Focusing

Sam Shaplygin sshaplygin

🎯
Focusing
View GitHub Profile
@sshaplygin
sshaplygin / constans.go
Last active April 16, 2020 23:08
Golang max and min math constants with bytes shifts from SOF https://stackoverflow.com/questions/6878590/the-maximum-value-for-an-int-type-in-go
const MaxUint = ^uint(0)
const MinUint = 0
const MaxInt = int(MaxUint >> 1)
const MinInt = -MaxInt - 1
@sshaplygin
sshaplygin / docker-compose.yml
Created January 6, 2020 22:18
Basic docker-compose file to rethinkDB
version: '3'
services:
rethink:
image: rethinkdb # load latest rethinkDB image
volumes:
- ./rethinkdb_data:/data/rethinkdb_data # volume for load backup or save new data files on mapping
ports:
- 8080:8080 # Listening for administrative HTTP connections on port 8080
- 28015:28015 # Listening for client driver connections on port 28015
- 29015:29015 # Listening for intracluster connections on port 29015
@sshaplygin
sshaplygin / getFileName.js
Last active January 18, 2019 11:19
load files from directory and subdirectiry in nodejs
module.exports = (filePath) => {
const dirPathArr = filePath.split('/');
const targerFile = dirPathArr[dirPathArr.length - 1];
const dotIndex = targerFile.indexOf('.');
return targerFile.slice(0, dotIndex > -1 ? dotIndex : targerFile.length);
}
@sshaplygin
sshaplygin / comments.py
Last active April 27, 2019 11:47
add symbol "*" to full file program
#!/usr/bin/python3
import os
if name == 'main':
print('Start append')
currentDir = os.getcwd()
addSymbol = '*'
fileNames = os.listdir(currentDir)
docs = list(filter(lambda x: not x.endswith('.py'), fileNames))