Skip to content

Instantly share code, notes, and snippets.

@will3942
will3942 / kvm.sh
Last active October 12, 2016 18:18
Running OS X under QEMU/KVM
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 June 11, 2024 12:17
Reverse-Engineering Instagram
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 December 4, 2013 21:34
Go: Markdown blogging system.
package main
import (
"html/template"
"net/http"
"path/filepath"
"strings"
"io/ioutil"
"github.com/russross/blackfriday"
)
@will3942
will3942 / post.html
Created December 4, 2013 21:33
Go: 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 December 4, 2013 21:29
Go: new request handler
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 December 4, 2013 21:04
Go: append Post to the Posts array
a = append(a, Post{title, date, summary, body, file})
}
return a
@will3942
will3942 / read_file.go
Created December 4, 2013 21:03
Go: read file and get values
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 December 4, 2013 21:02
Go: looping through files in a directory
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 December 4, 2013 21:02
Go: getPosts() function
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])
@will3942
will3942 / posts_object.go
Created December 4, 2013 21:01
Go: posts object
type Post struct {
Title string
Date string
Summary string
Body string
File string
}