Skip to content

Instantly share code, notes, and snippets.

View kidtronnix's full-sized avatar

Simon Maxwell-Stewart kidtronnix

View GitHub Profile
@kidtronnix
kidtronnix / sane-async-each.js
Last active August 29, 2015 14:00
sane-async-each.js
// Okay I have some shit i need to do in order
// FACK
// it's cool just do this...
async.each( /*array*/ obects_for_the_block, /*fun()*/ chopping_block, function(err){
// EXPLANATION
// chopping_block is the function that is performed on every object in
// objects_for_the_block.
// imagine metaphor. understand.
@kidtronnix
kidtronnix / mongo-db-connection.js
Last active August 29, 2015 14:06
MongoDB Connection
// Creates db connection object
var db = new MongoDB(config.db.name, new Server(config.db.host, config.db.port, {auto_reconnect: true}), {w: 1});
db.open(function(e, d) {
if (e) {
console.log(e);
} else{
console.log('connected to database');
}
})
@kidtronnix
kidtronnix / vimrc
Last active July 11, 2018 14:05
vimrc
" Make menu pretty and nice
let g:netrw_banner = 0
let g:netrw_liststyle = 3
let g:netrw_browse_split = 4
let g:netrw_altv = 1
let g:netrw_winsize = 25
augroup ProjectDrawer
autocmd!
autocmd VimEnter * :Vexplore
augroup END
@kidtronnix
kidtronnix / uuid-time.go
Created July 23, 2015 00:25
Example of how to get timestamp from v1 UUID in GOLANG
package main
import (
"fmt"
"time"
"github.com/pborman/uuid"
)
func main() {
@kidtronnix
kidtronnix / xss.html
Last active August 29, 2015 14:28
XSS Example
<!-- User -->
<comment>
Hi can anyone recommend a good film?
</comment>
<!-- Attacker-->
<comment>
<script src="xss.js"></script>
I like star wars!
<a id="its-a-trap" href="#">Check it out.</a>
package main
import "fmt"
type A struct {
OnlyForA string
}
func (a *A) Eyo() {
fmt.Println("eyo")
package main
import (
"encoding/csv"
"fmt"
"io"
"log"
"os"
)
@kidtronnix
kidtronnix / backward.go
Last active September 13, 2018 20:11
Nueral Net Forward Pass
package nn
import "gonum.org/v1/gonum/mat"
func (n *MLP) backward(x, y mat.Matrix) {
// get activations
as, zs := n.forward(x)
// final z
package nn
import "gonum.org/v1/gonum/mat"
// forward takes input data and returns the 'activation' and 'z'
// from each layer - z = w.x +b and a = sigmoid(z)
func (n *MLP) forward(x mat.Matrix) (as, zs []mat.Matrix) {
as = append(as, x) // first activation is input
_x := x
package nn
import (
"fmt"
"gonum.org/v1/gonum/mat"
)
func (n *MLP) Train(x, y *mat.Dense) {