Skip to content

Instantly share code, notes, and snippets.

View vicneanschi's full-sized avatar

Valeri Vicneanschi vicneanschi

  • Montreal, Canada
View GitHub Profile
@vicneanschi
vicneanschi / nvmuse.md
Created November 17, 2021 21:22 — forked from danpetitt/nvmuse.md
Using nvmrc on Windows

Using nvmrc on Windows

Unfortunately nvm use on Windows does not change the node version to that specified in the .nvmrc file as its not supported on nvm for Windows: coreybutler/nvm-windows#388

So the easiest solution to this is to use a simple Powershell command that performs an approximation of the command as follows: nvm use $(Get-Content .nvmrc).replace( 'v', '' );

However, thats a bit awkward and we can do a bit more so instead, we can create an 'alias' to a function that calls the command instead:

function callnvm() {
@vicneanschi
vicneanschi / expose-docker-demon.sh
Last active February 27, 2020 00:21
expose Docker daemon
docker run -d --restart=always -p 127.0.0.1:23750:2375 -v /var/run/docker.sock:/var/run/docker.sock alpine/socat tcp-listen:2375,fork,reuseaddr unix-connect:/var/run/docker.sock
# netstat -an | find /i "listening" | grep 23750
# docker -H tcp://localhost:23750 ps
@vicneanschi
vicneanschi / 1p
Created February 14, 2020 03:22 — forked from justinline/1password clipboard
1password command line clipboard copying
# Short alias to allow automated copying of the 1password cli tool command 'op get somewebsite | jq ...' and then a timed clear on the gnome clipboard
# TODO: specify designation as an argument and maybe a command to open the website in chrome
pass=$(op get item $1 | jq -r '.details.fields[] | select(.designation=="password").value')
if [ -n "$pass" ]
then
echo $pass | xclip -selection clipboard
echo "Password was copied - clipboard will be wiped in 15 seconds"
sleep 15
timur@timur-ThinkPad-T61 /etc/openhab2/rules $ cat val.rules
import java.util.Random
rule "Enable night pre-heating"
when
Time cron "0 0 19 * * ?"
then
zwave_device_7ca468ca_node3_thermostat_setpoint_heating.sendCommand(20)
#!/bin/bash
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)
@vicneanschi
vicneanschi / describe.groovy
Last active December 20, 2017 21:21 — forked from robertdale/describe.groovy
JanusGraph Schema Describe Command
// This can be imported via ./bin/gremlin.sh -i describe.groovy
// A variable 'graph' must be defined with a JanusGraph graph
// Run it as a plugin command ':schema'
// :schema describe
//
import org.janusgraph.graphdb.database.management.MgmtLogType
import org.codehaus.groovy.tools.shell.Groovysh
import org.codehaus.groovy.tools.shell.CommandSupport
@vicneanschi
vicneanschi / Training.md
Last active September 11, 2017 18:07
Gym

micro cycle

1st week

Friday September 8

  • жим штанги лежа 5х5
  • присед со штангой 5х5
  • подтягивания прямым хватом 5х5
  • подтягивания обратным хватом 5х5

Monday September 11

@vicneanschi
vicneanschi / Play9.js
Last active August 24, 2017 23:50
React samples
// use https://jscomplete.com/repl to test
var possibleCombinationSum = function(arr, n) {
if (arr.indexOf(n) >= 0) { return true; }
if (arr[0] > n) { return false; }
if (arr[arr.length - 1] > n) {
arr.pop();
return possibleCombinationSum(arr, n);
}
var listSize = arr.length, combinationsCount = (1 << listSize)
@vicneanschi
vicneanschi / git.bash
Created April 4, 2017 13:46
git commands
In Git 1.7.0 and later, you can checkout a new branch:
git checkout -b <branch>
Edit files, add and commit. Then push with the -u option:
git push -u origin <branch>
Git will set up the tracking information during the push.
@vicneanschi
vicneanschi / spapshot.sql
Created March 3, 2017 13:58
MSSQL create/restore snapshot
--THis works only on local
USE Master
go
--Adjust Name as per logical name of the file() (database properties: Files), Ignore Log files
--Adjust FileName to where you want the snapshot to exists: it requires the same size of the original DB
CREATE DATABASE MySnap
ON (NAME = N'MyDB', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL13.SQLSERVER2016\MSSQL\DATA\MyDB.snap')
AS SNAPSHOT OF MyDB;
GO