Skip to content

Instantly share code, notes, and snippets.

View RavenZZ's full-sized avatar
🎯
Focusing

Raven RavenZZ

🎯
Focusing
View GitHub Profile
@RavenZZ
RavenZZ / sleep.js
Created August 5, 2016 01:51
javascript模拟线程阻塞
function sleep(milliSeconds) {
var startTime = new Date().getTime();
while (new Date().getTime() < startTime + milliSeconds);
}
@RavenZZ
RavenZZ / showConnection.sh
Created August 5, 2016 16:46
Show Connection Count
netstat -ant | awk '{print $6}' | sort | uniq -c | sort -n
@RavenZZ
RavenZZ / Startup.cs
Last active August 25, 2016 08:53
ASP.NET Core-获取所有注入(DI)服务
public class Startup
{
private IServiceCollection _services;
// This method gets called by the runtime. Use this method to add services to the container.
// For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
{
_services = services;
}
@RavenZZ
RavenZZ / save all npm packages allready installed.sh
Last active November 15, 2016 02:06
How to npm install --save all packages already installed
npm install `ls node_modules` --save
npm install `dir node_modules/` --save
@RavenZZ
RavenZZ / install scala.sh
Last active November 15, 2016 02:05
scala installation on centos
#http://backtobazics.com/scala/4-steps-to-setup-scala-on-centos/
#Step 1: Download Tarball OR RPM file of Scala 2.11.6 using below commands
cd /data
sudo wget http://downloads.typesafe.com/scala/2.12.0-M5/scala-2.12.0-M5.tgz
#Step 2: Installation
sudo cp /data/scala-2.12.0-M5.tgz /opt/
@RavenZZ
RavenZZ / clearSystemProfole.js
Last active November 15, 2016 02:05
Mongo system.profile
db.setProfilingLevel(0)
db.system.profile.drop()
@RavenZZ
RavenZZ / install spark.sh
Last active November 15, 2016 02:05
install spark
# https://www.tutorialspoint.com/apache_spark/apache_spark_installation.htm
#dowload file
sudo wget http://d3kbcqa49mib13.cloudfront.net/spark-2.0.0-bin-hadoop2.7.tgz
#move file to local
sudo tar xvf spark-2.0.0-bin-hadoop2.7.tgz
sudo mv spark-2.0.0-bin-hadoop2.7 /usr/local/spark
@RavenZZ
RavenZZ / install nodejs on centos.md
Last active November 15, 2016 02:04
How To Install And Run A Node.js App On Centos 6.4 64bit

Introduction

This article outlines the steps necessary to run a "Hello world" in node.js + express, running on a 64bit Centos 6.4 installation. We will be building the latest version of source (at this moment, v0.10.4) from the upstream provider.

As is written on their homepage, Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. This is a fast, event driven platform and server-side Javascript engine used for building web applications. DigitalOceans' droplets are a cost-effective way to install and start studying server-side Javascript and bulding or deploying web applications with Node.js.

Setup a VPS

@RavenZZ
RavenZZ / scala-ubuntu.md
Last active November 15, 2016 02:04
Ubuntu Scala

Ubuntu14.04下Scala开发环境搭建。

  1. 安装JDK,jdk-6u45-linux-x64.bin 将其安装到/usr/lib/jvm/jdk1.6.0_45/。
  2. 安装Scala,下载scala-2.11.4.tgz 将其解压到/usr/lib/jvm/scala-2.11.4/。
  3. 配置环境变量:
   vim /etc/profile
 
@RavenZZ
RavenZZ / combine.lua
Last active February 4, 2022 07:30
combine two request by openresty
cjson = require "cjson"
ngx. req. read_body() -- explicitly read the req body
local data = ngx. req. get_body_data()
local jsonBody = cjson. decode(data);
if data then
local reqs = { }
--ngx. say("body data:")
for key, value in pairs(jsonBody) do
--ngx.print(key)