Skip to content

Instantly share code, notes, and snippets.

View agamm's full-sized avatar
🍪
Cookie: cookies=∞;\r\n

Agam More agamm

🍪
Cookie: cookies=∞;\r\n
View GitHub Profile
@agamm
agamm / gist:d9bf9a1818e7142db311
Created March 13, 2015 21:03
XOR neural network
import pybrain
from pybrain.datasets import *
from pybrain.tools.shortcuts import buildNetwork
from pybrain.supervised.trainers import BackpropTrainer
import pickle
if __name__ == "__main__":
ds = SupervisedDataSet(2, 1)
ds.addSample( (0,0) , (0,))
ds.addSample( (0,1) , (1,))
@agamm
agamm / gist:e0363f4998e39703daa0
Created May 16, 2015 20:45
Custom Go HTTP Response
func all(w http.ResponseWriter, r *http.Request) {
someText := "Some custom message for the redirect"
hj, ok := w.(http.Hijacker)
if !ok {
http.Error(w, "Webserver doesn't support hijacking", http.StatusInternalServerError)
return
}
conn, bufrw, err := hj.Hijack()
checkErr(w, err)
<?php
/* Plugin Name: Damn Vulnerable WordPress Plugin
* Description: Intentionally vulnerable plugin for plugin author education
* Version: 0.1
* Plugin URI: http://make.wordpress.org/plugins/2013/04/09/intentionally-vulnerable-plugin/
* Author: Jon Cave
* Author URI: http://joncave.co.uk
* License: GPLv2+
*
* DO NOT RUN THIS PLUGIN ON AN INTERNET ACCESSIBLE SITE
@agamm
agamm / gist:5487668
Created April 30, 2013 09:36
Laravel 3 Naming Convenstions
1) Database:
table name (Eg. users)
field name (Eg. department_id)
2)Controllers:
Name_of_the_controller + _Controller. (Where the name of the controller normally starts with a capital letter. The filename should be the same with name of the controller.)
3) Models:
Name_Model (try to spesify in a single word (eg. no underscores).
@agamm
agamm / autoscroll
Created July 5, 2013 21:08
Automatically scroll webpages (nice for reading online) Installation: Create a new bookmark, call it: "Autoscroll", and in the URL field enter the code below:
javascript: var x = 1 * prompt("Start From:", window.pageYOffset);var s = 1 * prompt("Speed:", 0.03);var time = document.createElement("div");time.style.position = "fixed";time.style.top = "90%";time.style.left = "90%";document.body.appendChild(time);if (x != null && s !== null) {window.setInterval(function () {if (x + window.innerHeight <= document.height) {x += s;document.body.scrollTop = x;time.innerHTML = ((document.height - (x + window.innerHeight)) / (s * 100)).toFixed(2) + "s";}}, 10);}
@agamm
agamm / gist:6065556
Created July 23, 2013 19:49
My Basic Grunt Setup
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
uglify: {
options: {
banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %> */'
},
my_target: {
@agamm
agamm / gist:6271077
Created August 19, 2013 16:30
Epic up shell command. Tired of doing cd .. or cd ../ all the time?
up(){
limit=$1
startloc=`pwd`
for((i=1 ; i <= limit ; i++))
do
cd ..
done
echo "From: $startloc"
echo 'To: ' `pwd`
}
@agamm
agamm / index.android.js
Created May 10, 2016 15:12
React native basic navigation
/**
* Sample React Native App
* https://github.com/facebook/react-native
*/
import React, { Component } from 'react'
import { AppRegistry, StyleSheet, Text, View, Navigator, ToolbarAndroid, TouchableHighlight } from 'react-native'
class reactgame extends Component {
render () {

If you have many files of go test runs concat like so: cat <path>/* > concat_tests.raw

Call: python t.py concat_tests.raw

@agamm
agamm / fixLinks.js
Last active October 13, 2022 21:58
Fix Ghost newsletter links and add ?ref= to referenced links