Skip to content

Instantly share code, notes, and snippets.

@moonblade
moonblade / instructions
Last active June 26, 2016 11:25
latex abstract generation
run latex.sh, open abstract.tex file, edit it as required. then run ./generate.sh
@moonblade
moonblade / bfs
Last active April 18, 2016 17:23
DAA
BFS
------
Breadth first search of graph
isolated nodes won't be reached
coloring mechanism used to track undiscovered(white), discovered (gray) and exhausted(black) nodes
BFS(G,V)
//all elements are initialised with color white, inf distance and no predecessor
for all v element V
#include <random>
#include <iostream>
int main() {
int start=1,stop=100, amount=100;
std::random_device rd;
std::mt19937 mt(rd());
std::uniform_real_distribution<double> dist(start, stop);
for (int i=0; i<amount; ++i)
std::cout << dist(mt) << "\n";
{
"code": 1,
"buildingList": [{
"buildingId": "1",
"buildingName": "Sensomate",
"buildingDescription": "An okay sort of company",
"floorList": [{
"floorId": "1",
"pictureURL": "http://192.168.0.122/sensomate/BLENavigation/pictures/1234/",
"size": {
.get no of rotation = (angle/1.8 degree) in hex
MOV BL,<NO OF ROTATIONS IN HEX>
.di = start of 09,05,06,0a
MOV DI,1021
.count of four to loop through dl
MOV CL,04
.get to al
MOV AL,[DI]
.write to motor
OUT C0,AL
.Mode 0
.start location 1000
.90 is to operate in mode 0 (10010000 -> command word a, and the second 1, port a is input)
MOV AL,90
.write to the command word
OUT C6,AL
.address 1006:
.read input from port a
IN AL,C0
.write the same input to port b
commands
A
for assembler
type a and then type the address you want to type the program in, then proceed to type the program
one enter for converting to hex, two enters for save
press . and enter when you wish to leave, or press interupt
U
unassambler
@moonblade
moonblade / netcat.py
Created March 14, 2016 12:51
Netcat program done entirely in python
#!/usr/bin/env python3
import socket
import sys
class Connection:
def send(self, hostname, port, content):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.connect((hostname, int(port)))
@moonblade
moonblade / burn.py
Last active January 11, 2024 13:29
A python tool to burn iso files to usb disks through interactive menu
#!/usr/bin/env python3
import os
import sys
from glob import iglob
from subprocess import Popen, PIPE
import time
import signal
from decimal import Decimal, localcontext, ROUND_DOWN
.model small
.data
matrix1 db 01h,02h,03h,04h,05h,06h,07h,08h,09h
matrix2 db 04h,05h,06h,07h,08h,09h,01h,02h,03h
result db 09h dup(0)
row db 03h
column db 03h
offst db 00
isprime db 00
tocheck db ?