Skip to content

Instantly share code, notes, and snippets.

maicon filewalkwithme

Block or report user

Report or block filewalkwithme

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@filewalkwithme
filewalkwithme / regex_cve.go
Last active Apr 19, 2018
Extract CVE numbers from a target string
View regex_cve.go
package main
import (
"fmt"
"regexp"
)
func main() {
// https://cve.mitre.org/cve/identifiers/tech-guidance.html#extraction_or_parsing
var cveRegex = regexp.MustCompile(`(?i)(CVE-\d{4}-(0\d{3}|[1-9]\d{3,}))`)
@filewalkwithme
filewalkwithme / example.json
Last active Mar 28, 2018
Read JSON from a file, update the content and then write it to the same file again
View example.json
{"hola":"mundo","number":1}
View cancel2.go
package main
import (
"context"
"log"
"sync"
"time"
)
var wg sync.WaitGroup
View cancel_goroutines.go
package main
import (
"context"
"log"
"sync"
"time"
)
var wg sync.WaitGroup
@filewalkwithme
filewalkwithme / postgres-docker.txt
Last active Jul 1, 2017
run a local postgres container
View postgres-docker.txt
# How to run the container
docker run --rm --name container-name -p 5432:5432 -e POSTGRES_USER=username -e POSTGRES_DB=dbname -e POSTGRES_PASSWORD=password -v /local/path/to/data/:/var/lib/postgresql/data postgres
# How to connect via psql
psql -h 0.0.0.0 -U username -W
@filewalkwithme
filewalkwithme / run_ec2_instance.go
Created Apr 5, 2015
Running Amazon EC2 instances with Golang
View run_ec2_instance.go
// from: http://maicon.io/golang-running-aws-ec2-instances.html
package main
import (
"fmt"
"os"
aws "github.com/goamz/goamz/aws"
ec2 "github.com/goamz/goamz/ec2"
)
@filewalkwithme
filewalkwithme / main.go
Last active Jun 15, 2019
Listening multiple ports on golang http servers (using http.Handler)
View main.go
package main
import (
"net/http"
)
func main() {
go func() {
http.ListenAndServe(":8001", &fooHandler{})
}()
@filewalkwithme
filewalkwithme / main.go
Created Feb 7, 2015
Listening multiple ports on golang http servers
View main.go
package main
import (
"net/http"
)
func main() {
finish := make(chan bool)
server8001 := http.NewServeMux()
@filewalkwithme
filewalkwithme / WakeOnLan.java
Last active Dec 15, 2015
Java Class for Wake On Lan
View WakeOnLan.java
/* maiconio
* http://pistach.es/
*/
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetSocketAddress;
import java.net.SocketException;
@filewalkwithme
filewalkwithme / sample_wol.lua
Created Jun 4, 2012
Lua Wake-On-Lan Script
View sample_wol.lua
function split(str, pat)
local t = {}
local fpat = "(.-)" .. pat
local last_end = 1
local s, e, cap = str:find(fpat, 1)
while s do
if s ~= 1 or cap ~= "" then
table.insert(t,cap)
end
last_end = e+1
You can’t perform that action at this time.