Skip to content

Instantly share code, notes, and snippets.

@will3942
will3942 / kvm.sh
Last active Oct 12, 2016
Running OS X under QEMU/KVM
View kvm.sh
git clone git://git.kernel.org/pub/scm/virt/kvm/kvm.git
git clone git://git.kiszka.org/kvm-kmod.git
cd kvm-kmod
./configure
make LINUX=../kvm clean sync all
modprobe -r kvm_intel
cp ./x86/kvm*.ko /lib/modules/$(uname -r)/kernel/arch/x86/kvm/
modprobe kvm_intel
@will3942
will3942 / app.rb
Last active Sep 15, 2021
Reverse-Engineering Instagram
View app.rb
require 'openssl'
require 'base64'
require 'json'
require 'httpclient'
http = HTTPClient.new(:agent_name => useragent)
key = "" #The Private key
login_info = {:guid => "00000000-0000-0000-0000-000000000000",
:password => "PASSWORD",
:username => "USERNAME",
@will3942
will3942 / blog.go
Created Dec 4, 2013
Go: Markdown blogging system.
View blog.go
package main
import (
"html/template"
"net/http"
"path/filepath"
"strings"
"io/ioutil"
"github.com/russross/blackfriday"
)
View post.html
<html>
<body>
<h1>Will's Blog!</h1>
<a href="/{{.File}}"><h2>{{.Title}} ({{.Date}})</h2></a>
<p>{{.Body}}</p>
</body>
</html>
@will3942
will3942 / new_request_handle.go
Created Dec 4, 2013
Go: new request handler
View new_request_handle.go
func handlerequest(w http.ResponseWriter, r *http.Request) {
if (r.URL.Path[1:] == "") {
posts := getPosts()
t := template.New("index.html")
t, _ = t.ParseFiles("index.html")
t.Execute(w, posts)
} else {
f = "posts/" + r.URL.Path[1:] + ".md"
fileread, _ := ioutil.ReadFile(f)
lines := strings.Split(string(fileread), "\n")
@will3942
will3942 / post_append.go
Created Dec 4, 2013
Go: append Post to the Posts array
View post_append.go
a = append(a, Post{title, date, summary, body, file})
}
return a
@will3942
will3942 / read_file.go
Created Dec 4, 2013
Go: read file and get values
View read_file.go
fileread, _ := ioutil.ReadFile(f)
lines := strings.Split(string(fileread), "\n")
title := string(lines[0])
date := string(lines[1])
summary := string(lines[2])
body := strings.Join(lines[3:len(lines)], "\n")
body = string(blackfriday.MarkdownCommon([]byte(body)))
@will3942
will3942 / file_loop.go
Created Dec 4, 2013
Go: looping through files in a directory
View file_loop.go
a := []Post{}
files, _ := filepath.Glob("posts/*")
for _, f := range files {
file := strings.Replace(f, "posts/", "", -1)
file = strings.Replace(file, ".md", "", -1)
@will3942
will3942 / get_posts.go
Created Dec 4, 2013
Go: getPosts() function
View get_posts.go
func getPosts() []Post{
a := []Post{}
files, _ := filepath.Glob("posts/*")
for _, f := range files {
file := strings.Replace(f, "posts/", "", -1)
file = strings.Replace(file, ".md", "", -1)
fileread, _ := ioutil.ReadFile(f)
lines := strings.Split(string(fileread), "\n")
title := string(lines[0])
date := string(lines[1])
View posts_object.go
type Post struct {
Title string
Date string
Summary string
Body string
File string
}