Skip to content

Instantly share code, notes, and snippets.

View larzconwell's full-sized avatar

Larz Conwell larzconwell

View GitHub Profile
View gist:9624785
package main
import (
"fmt"
"github.com/peterh/liner"
)
func main() {
state := liner.NewLiner()
line, err := state.Prompt("> ")
View wtf.js
ports = [22, 80]
data = {ports: {}}
ports.forEach(function (p) {
var addr = 'localhost:' + p
data.ports[p] = addr // For some reason keys end up strings, event though p is a number.
})
console.log(data.ports)
View input.go
// Writes stdin to output.log
package main
import (
"os"
"io"
)
func main() {
output, err := os.Create("output.log")
View gist:b659c3d74e2402dce0aa
In file included from ./osquery.go:5:
In file included from ./osquery.hh:4:
/usr/local/include/osquery/sql.h:5:10: fatal error: 'map' file not found
#include <map>
View error output
# _/Users/larz/Programming/random
duplicate symbol __Z3addii in:
/var/folders/kz/fgkgncp17mg8t84dm5jjvzvm0000gn/T//go-link-Vas0Gn/000000.o
/var/folders/kz/fgkgncp17mg8t84dm5jjvzvm0000gn/T//go-link-Vas0Gn/000001.o
ld: 1 duplicate symbol for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
/usr/local/go/pkg/tool/darwin_amd64/6l: running clang failed: unsuccessful exit status 0x100
View index.php

Steps

  1. Create a directory to hold your code.
  2. Open Bowery.
  3. Create a new application.
  4. Search for an image named "PHP 5.5 Apache" and click it.
  5. Empty the command to run input, since we'll be using the apache httpd.
  6. Set the remote directory to "/var/www/html".
  7. Set the local directory to the directory your code lives in.
  8. Wait until the application is running.
View gist:e6baa64c11b6a0e77d5a
package main
import (
"flag"
"github.com/Bowery/prompt"
"os"
)
var (
prefix string
View gist:2b35465add94f6005779
package main
import (
"github.com/fsouza/go-dockerclient"
"os"
"fmt"
)
func main() {
client, err := docker.NewClient("unix:///var/run/docker.sock")
View reverse.c
#include <assert.h>
#include <string.h>
void reverse(char *str) {
size_t len = strlen(str);
size_t half = len >> 1;
for (int i = 0; i < half; i++) {
int ei = (len - 1) - i;
char begin = str[i];
@larzconwell
larzconwell / gist:1796546
Created February 11, 2012 04:58
Interactive shell script prompt
View gist:1796546
init_num=0
init() {
init_num=$(expr $init_num + 1)
if [[ "$init_num" -le "9" ]]; then
read -p "Uni:00$init_num> " input
elif [[ "$init_num" -ge "10" ]] && [[ "$init_num" -le "99" ]]; then
read -p "Uni:0$init_num> " input
elif [[ "$init_num" -ge "100" ]] && [[ "$init_num" -le "999" ]]; then
read -p "Uni:$init_num> " input
else