Skip to content

Instantly share code, notes, and snippets.

View vadimshvetsov's full-sized avatar

Vadim Shvetsov vadimshvetsov

  • Amazon
  • Berlin, Germany
View GitHub Profile
@vadimshvetsov
vadimshvetsov / objectToDotNotation.js
Created May 25, 2017 11:56
Function for merging objects in find*Update function with one level nesting.
/**
* Consume update args object for document and can handle one level nesting.
* Returns object for leverage by $set in Mongoose update function.
*
* @param args
* @returns {{}}
*/
const objectToDotNotation = (args) => {
const setObject = {};
Object.keys(args).forEach((key) => {
@vadimshvetsov
vadimshvetsov / copytime.sh
Last active January 27, 2017 12:36
Script for copy datetime from original MOV/MP4 file to compressed.
#!/bin/bash
# Get all files with uppercase MP4 and MOV
files='*.MP4 *.MOV';
# Go through files
for f in $files;
do
# Create a regexp for find compressed file
regexp=$(echo $f | sed -e "s/\(.*\)\(\.\)\(...\)/\1\*.\L\3/"| tr -d '\n');
# Find compressed file
@vadimshvetsov
vadimshvetsov / coreos.sh
Last active April 14, 2017 21:26
CoreOS choose release channel alpha and update
#!/bin/bash
echo "GROUP=alpha" > /etc/coreos/update.conf # This is not good idea because of unstable updates, so risky for production
sudo systemctl restart update-engine
update_engine_client -check_for_update
# for checking os version after restarting
cat /etc/os-release
# source from https://coreos.com/os/docs/latest/switching-channels.html