Look at LSB init scripts for more information.
Copy to /etc/init.d
:
# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
#include <iostream> | |
#include <boost/uuid/sha1.hpp> | |
void display(char* hash) | |
{ | |
std::cout << "SHA1: " << std::hex; | |
for(int i = 0; i < 20; ++i) | |
{ | |
std::cout << ((hash[i] & 0x000000F0) >> 4) | |
<< (hash[i] & 0x0000000F); |
package main | |
import ( | |
"bufio" | |
"log" | |
"net/rpc" | |
"os" | |
) | |
func main() { |
Look at LSB init scripts for more information.
Copy to /etc/init.d
:
# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
//============================================================================ | |
// Name : OctaneCrawler.cpp | |
// Author : Berlin Brown (berlin dot brown at gmail.com) | |
// Version : | |
// Copyright : Copyright Berlin Brown 2012-2013 | |
// License : BSD | |
// Description : This is the simplest possible web crawler in C++ | |
// Uses boost_regex and boost_algorithm | |
//============================================================================ |
Let's have some command-line fun with curl, [jq][1], and the [new GitHub Search API][2].
Today we're looking for:
/* | |
This program is an adaptation of the Mandelbrot program | |
from the Programming Rosetta Stone, see | |
http://rosettacode.org/wiki/Mandelbrot_set | |
Compile the program with: | |
gcc -o mandelbrot -O4 mandelbrot.c | |
Usage: |
When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:
const Article = require('../../../../app/models/article');
Those suck for maintenance and they're ugly.
// function will take a number of days, a collection name, an index Field name, and a boolean as args | |
// it assumes the index is ObjectID based and creates an ObjectID with a timestamp X days in the past | |
// Finally, it queries that index/data (controlled by boolean), loading it into memory | |
// | |
// Example - 2 days data, foo collection, _id index, pre-heat index only | |
// preHeatData(2, "foo", "_id", true) | |
// Example - 7 days data, foo collection, _id index, pre-heat data also | |
// preHeatData(7, "foo", "_id", false) | |
// Example - 2 days data, bar collection, blah index, pre-heat index only | |
// preHeatData(2, "bar", "blah", false) |
package main | |
import ( | |
"crypto/tls" | |
"crypto/x509" | |
"flag" | |
"io/ioutil" | |
"log" | |
"net/http" | |
) |