Skip to content

Instantly share code, notes, and snippets.

View NaxAlpha's full-sized avatar
😎
Solving Intelligence

Nauman Mustafa NaxAlpha

😎
Solving Intelligence
View GitHub Profile
@NaxAlpha
NaxAlpha / shell.c
Created January 29, 2017 04:38
Shellcode with C using Visual Studio
// This code is for backup
// Original Aritcle Reference
// https://nickharbour.wordpress.com/2010/07/01/writing-shellcode-with-a-c-compiler/
#include <stdio.h>
#include <Windows.h>
#include <winternl.h>
#include <wchar.h>
#include <tlhelp32.h>
@NaxAlpha
NaxAlpha / VBUtils.vb
Created July 5, 2017 10:15
Visual Basic Common Utility Functions
'File: VBUtils.vb
'Author: Nauman Mustafa
'License: MIT
'Modified: 05-July-2017
'Description: Small List of Utility functions for general use, just include file in your project to use
Public Module VBUtils
'Private Variables
Dim Rnd As New Random
@NaxAlpha
NaxAlpha / Pointer.vb
Created July 14, 2017 14:43
VB.Net implementation of unsafe C# pointers.
'File: Pointer.vb
'Author: Nauman Mustafa
'License: MIT
'Modified: 14-July-2017
'Description: Basic implementation of C++ pointers in VB.NET, is used for unsafe C# code conversion via Telerik Code Converter (Unofficial)
' If you convert c# unsafe code via Telerik code converter, pointers in C# get reference to Pointer(Of T) structure
' It can't be exactly as C# one because there is no function to get pointer of .net variable.
Imports System.Runtime.InteropServices
@NaxAlpha
NaxAlpha / StatelessRL.vb
Created August 25, 2017 14:37
Example of Stateless Reinforcement learning
Imports System
Imports System.Threading
Module Program
Dim r As New Random
Private Function RewardOf(value As Integer, thresh As Integer) As Integer
Return If(value < thresh, 1, -1)
End Function
Public Function GetReward(actId As Integer) As Integer
@NaxAlpha
NaxAlpha / QL.vb
Last active September 21, 2017 15:19
Q-Learning with Tables
'Ref: https://medium.com/emergent-future/simple-reinforcement-learning-with-tensorflow-part-0-q-learning-with-tables-and-neural-networks-d195264329d0
Imports System.Threading
Module Program
Public Sub Main()
Dim actionNames = {"Left", "Top", "Right", "Bottom"}
Dim env As New FrozenLake(10)
Dim agent As New QAgent(env.StateCount, env.ActionCount, True)
Dim state = env.Reset()
@NaxAlpha
NaxAlpha / Test.vb
Created September 30, 2017 19:23
Tiny ISA - Very Tiny Implementation of Virtual Machine long with custom Instruction Set Architecture. Have fun add new instructions, device drivers and other OS primitives
'License: https://creativecommons.org/licenses/by/4.0/legalcode
Imports System.IO
Imports System.Linq.Expressions
Imports System.Reflection
Imports System.Runtime.InteropServices
Module Program
Private Function CreateDrive(name As String, len As Integer) As Stream
Dim fx = File.Open(name, FileMode.OpenOrCreate)
import cv2
import numpy as np
from collections import namedtuple as Tuple
from recordclass import recordclass as Record
Line = Tuple('Line', 'x y count spacing staff')
Staff = Tuple('Staff', 'x sy ey w h points spacing lncount')
Point = Tuple('Point', 'x y group spacing')
if __name__ == '__main__':
@NaxAlpha
NaxAlpha / east.py
Last active June 25, 2018 10:34
EAST Eval Script for Frozen Graph
# EAST - Efficient & Advanced Scene Text Detector
# Python Tensorflow Frozen Implementation
# Used for Generating Embedded Executable
import os
import cv2
import sys
import time
import numpy as np
import tensorflow as tf
@NaxAlpha
NaxAlpha / msra_to_east.py
Created July 5, 2018 08:06
EAST Helper Scripts
# This script converts msra ground truth format to east training format
# Download and extract MSRA, cd <MSRA_DIR>, mkdir out and run this script
# https://github.com/argman/EAST
import os
import math
import shutil
import numpy as np
rotate = lambda xy, theta: [xy[0] * math.cos(theta) - xy[1] * math.sin(theta),xy[0] * math.sin(theta) + xy[1] * math.cos(theta)]
@NaxAlpha
NaxAlpha / fab-pure.py
Last active July 12, 2018 09:27
[VX] Tensorflow-Fun: Build Fibonacci Series using Tensorflow
# Pure TF implm.
# Fibonacci series using tensorflow
import tensorflow as tf
import numpy as np
import time
def build_graph2(max_count):
init = np.zeros([max_count], dtype=int)
m0 = tf.Variable(init,dtype=tf.int32)
i0 = tf.constant(2)