Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
# From Gerrit Code Review 2.5-rc0
#
# Part of Gerrit Code Review (http://code.google.com/p/gerrit/)
#
# Copyright (C) 2009 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
<form name="survey" id="ratingaccomplish">
<div id="offerRating" style="display: block;">
<hr>
<label for="rating"><b>Rate your download experience:</b></label>
<p>
<span class="star-rating-control">
<div class="rating-cancel" style="display: none;"><a title="Cancel Rating"></a></div>
<div class="star-rating rater-0 star required star-rating-applied star-rating-live" id="Rating_1"><a title="1">1</a></div>
<div class="star-rating rater-0 star star-rating-applied star-rating-live" id="rating_2"><a title="2">2</a></div>
<div class="star-rating rater-0 star star-rating-applied star-rating-live" id="Rating_3"><a title="3">3</a></div>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>mycompany-repository</id>
<username>admin</username>
<password>password</password>
</server>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycom.app</groupId>
<artifactId>my-app</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>my-app</name>
<url>http://maven.apache.org</url>
<dependencies>
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.codehaus.mojo</groupId>
<artifactId>wagon-maven-plugin</artifactId>
<packaging>pom</packaging>
<version>${version}</version>
<build>
var Connection = require('ssh2');
var c = new Connection();
c.on('connect', function() {
console.log('Connection :: connect');
});
c.on('ready', function() {
console.log('Connection :: ready');
c.exec('uptime', function(err, stream) {
if (err) throw err;
The objective of this post is to get you from absolutely nothing, to a fully functional nodejs environment.
Software used: Ubuntu 11.10, Nodejs v0.6.12, Nginx, MongoDB, Redis, and NPM modules.
1. Download and install the latest version of Ubuntu: http://www.ubuntu.com/download (don't select any extra items to install when prompted)
2. Once you are logged in and are at your Ubuntu command prompt, install the necessary software you will need:
a. sudo apt-get install openssh-server
b. sudo apt-get install libssl-dev
c. sudo apt-get install git
d. sudo apt-get install g++
e. sudo apt-get install make
@lifuzu
lifuzu / jsonval.sh
Created August 31, 2013 00:45 — forked from cjus/jsonval.sh
#!/bin/bash
function jsonval {
temp=`echo $json | sed 's/\\\\\//\//g' | sed 's/[{}]//g' | awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}' | sed 's/\"\:\"/\|/g' | sed 's/[\,]/ /g' | sed 's/\"//g' | grep -w $prop`
echo ${temp##*|}
}
json=`curl -s -X GET http://twitter.com/users/show/$1.json`
prop='profile_image_url'
picurl=`jsonval`
@lifuzu
lifuzu / get_filename_from_header
Created September 19, 2013 20:45
Get filename option from http request header
/**
* @param part
* @return
*/
private String getFileName(final Part part) {
final String partHeader = part.getHeader("content-disposition");
for (String content : partHeader.split(";")) {
if (content.trim().startsWith("filename")) {
return content.substring(content.indexOf('=') + 1).trim().replace("\"", "");
@lifuzu
lifuzu / tomcat_auto_reboot.sh
Last active December 23, 2015 18:59
put it into /etc/init.d/tomcat
#!/bin/bash
### BEGIN INIT INFO
# Provides: tomcat
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start/Stop Tomcat server
### END INIT INFO