Skip to content

Instantly share code, notes, and snippets.

@laobubu
laobubu / ABOUT.md
Last active May 27, 2024 21:40
A very simple HTTP server in C, for Unix, using fork()

Pico HTTP Server in C

This is a very simple HTTP server for Unix, using fork(). It's very easy to use

How to use

  1. include header httpd.h
  2. write your route method, handling requests.
  3. call serve_forever("12913") to start serving on port 12913
@francoishill
francoishill / loop_files_folders_recursively.go
Created August 1, 2014 16:52
Loop through files and folders recursively in golang
package main
import (
"fmt"
"os"
"path/filepath"
)
func main() ([]string, error) {
searchDir := "c:/path/to/dir"
@mcxiaoke
mcxiaoke / multipart.java
Created February 11, 2014 06:06
multipart request using httpurlconnection
public String multipartRequest(String urlTo, String post, String filepath, String filefield) throws ParseException, IOException {
HttpURLConnection connection = null;
DataOutputStream outputStream = null;
InputStream inputStream = null;
String twoHyphens = "--";
String boundary = "*****"+Long.toString(System.currentTimeMillis())+"*****";
String lineEnd = "\r\n";
String result = "";
@jonlabelle
jonlabelle / television_resolution_standards.md
Last active May 5, 2024 04:02
Digital and analog television standards resolution reference.

Television Standards

Digital and analog television standards resolution reference.

Digital TV Standards

Standard Resolution (dots × lines) DAR (H:V) Pixels
PixelVision 120 × 90 4:3 10,800
@ir-g
ir-g / app.xml
Created November 24, 2012 19:26
An example app page.
<app>
<meta>
<app:title>Title</app:title>
<app:icon type="47px-47px">icon-47-47.png</app:icon>
</meta>
<page name="home">
<h1>Home</h1>
<a href="page:example">Want another page?</a>
</page>
<page name="example">
@ir-g
ir-g / index.php
Created October 28, 2012 11:03
Oink CMS-A basic web framework.
<?php include("latest-stable-handler.php"); launch_site(); ?>
@ir-g
ir-g / index.php
Created June 10, 2012 16:44
Lite_CMS Paging system.
<html>
<head>
<title>Pages</title>
<script type="text/javascript">
WebFontConfig = {
google: { families: [ 'Ubuntu:300:latin' ] }
};
(function() {
var wf = document.createElement('script');
wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
@ramsesoriginal
ramsesoriginal / index.php
Created March 9, 2012 10:59
PJAX-PHP: Untested Code, just as a sample how one coudl theoretically implement PJAX with PHP
<?php
$render_template=true;
if ($_SERVER["HTTP_X_PJAX"])
{
$render_template=false;
}
?>
<?php
if ($render_template) {
@jfmercer
jfmercer / prime_numbers.js
Created December 6, 2011 03:55
Simple Prime Number Test in node.js and express
//
// Created by John F. Mercer on Monday, December 5, 2011
// john.f.mercer@gmail.com
//
// tested on node 0.6.4 and express 2.5.1
//
var express = require('express'),
app = express.createServer();
app.use(express.logger());
@wilsonpage
wilsonpage / reqUrl.js
Created November 25, 2011 14:38
A function I made that wraps the node http.request function to make it a little more friendly. In my case I am using it for API route testing.
// module dependencies
var http = require('http'),
url = require('url');
/**
* UrlReq - Wraps the http.request function making it nice for unit testing APIs.
*
* @param {string} reqUrl The required url in any form
* @param {object} options An options object (this is optional)