Skip to content

Instantly share code, notes, and snippets.

Avatar

Larz Conwell larzconwell

View GitHub Profile
View ports.sh
ports () {
local items="$(sudo lsof -n -i -P | tr -s " " | cut -d " " -f 2,9,10 | \grep "LISTEN")"
printf "%-10s %-20s %s\n" "PID" "ADDRESS" "COMMAND"
if [[ "${items}" == "" ]]
then
return
fi
while read item
do
pid="$(echo "${item}" | awk '{print $1}')"
View cond_var.go
package main
import (
"fmt"
"sync"
"time"
)
var tasks []int
var wg sync.WaitGroup
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];
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 gist:e6baa64c11b6a0e77d5a
package main
import (
"flag"
"github.com/Bowery/prompt"
"os"
)
var (
prefix string
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 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 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 input.go
// Writes stdin to output.log
package main
import (
"os"
"io"
)
func main() {
output, err := os.Create("output.log")
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)
You can’t perform that action at this time.