Skip to content

Instantly share code, notes, and snippets.

@yrong
yrong / nodejs_installer.ps1
Created November 26, 2018 09:21 — forked from nweldev/nodejs_installer.ps1
Powershell script installing nodejs (with git) and some npm packages
write-host "`n ## NODEJS INSTALLER ## `n"
### CONFIGURATION
# nodejs
$version = "4.4.7-x64"
$url = "https://nodejs.org/dist/latest-v4.x/node-v$version.msi"
# git
$git_version = "2.9.2"
@yrong
yrong / install_python.ps1
Created December 17, 2018 07:59 — forked from carlosfunk/install_python.ps1
Powershell scripts for setting up a Python environment under Windows
# To run this file you will need to open Powershell as administrator and first run:
# Set-ExecutionPolicy Unrestricted
# Then source this script by running:
# . .\install_python.ps1
$save_dir=Resolve-Path ~/Downloads
$project_dir = "C:\Projects"
$virtualenv_dir = $project_dir + "\virtualenvs"
$client = New-Object System.Net.WebClient
@yrong
yrong / choco_installer.ps1
Created December 21, 2018 09:33
choco installer
### CONFIGURATION
### require administator rights
if (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
write-Warning "This setup needs admin permissions. Please run this file as admin."
break
}
package main
import (
"bytes"
"flag"
"fmt"
"log"
"net/http"
"net/url"
"runtime"
@yrong
yrong / pivot.js
Created August 31, 2019 13:25 — forked from parshap/pivot.js
Find pivot index
// Return the "pivot index" of the given array of numbers. The pivot index is
// the index where the sum of the numbers on the left is equal to the sum of
// the numbers on the right.
function pivot(numbers) {
validateInput(numbers);
// Find a pivot index by testing each index
for (var i = 0; i < numbers.length; i++) {
var leftSum = sum(numbers.slice(0, i));
var rightSum = sum(numbers.slice(i + 1));
@yrong
yrong / install.ps1
Created November 1, 2019 08:24
install node&pm2 and make app as service
write-host "check administator rights"
if (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
write-Warning "This setup needs admin permissions. Please run this file as admin."
exit
}
write-host "check os and powershell"
if (-NOT ([Environment]::Is64BitProcess))
{
@yrong
yrong / customEdge.html
Created November 12, 2019 13:33 — forked from davidjgraph/customEdge.html
Custom edge example for mxGraph
<!--
$Id: markers.html,v 1.4 2013/10/28 08:44:55 gaudenz Exp $
Copyright (c) 2006-2014, JGraph Ltd
Demonstrates creating a custom edge in mxGraph
-->
<html>
<head>
<title>Custom edge example for mxGraph</title>
@yrong
yrong / customEdge.html
Created November 12, 2019 13:33 — forked from davidjgraph/customEdge.html
Custom edge example for mxGraph
<!--
$Id: markers.html,v 1.4 2013/10/28 08:44:55 gaudenz Exp $
Copyright (c) 2006-2014, JGraph Ltd
Demonstrates creating a custom edge in mxGraph
-->
<html>
<head>
<title>Custom edge example for mxGraph</title>
[dynamic component](https://codesandbox.io/s/floral-water-i1ik1)
[single file component](https://codesandbox.io/s/simple-todo-app-with-vue-z2gjs)
// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package context_test
import (
"context"
"fmt"
"time"