Skip to content

Instantly share code, notes, and snippets.

View pi0's full-sized avatar
💭
I may be slow to respond.

Pooya Parsa pi0

💭
I may be slow to respond.
View GitHub Profile
Infix to Postfix Translation with Parentheses
Algorithm for Method processOperator to Include Parentheses
if the operator stack is empty OR the current operator is '('
Push the current operator onto the stack
else
Peek the stack and let topOp be the top operator.
while the stack is non-empty AND
precedence of the current operator is less than or equal to the topOp
package AP2014.sql.storage.cell;
public class DataCell extends AbstractCell{
public DataCell(String paramName,Object value,int maxValue,CellType type) {
super(paramName, value ,maxValue,type);
}
public boolean equals(MetaCell metaCell){
@pi0
pi0 / gen_ssl.sh
Created August 15, 2015 11:01
Generate SSL
# Private server key
sudo openssl genrsa -des3 -out server.key 2048
# Create certificate signing request
sudo openssl req -new -key server.key -out server.csr
# Remove the Passphrase
sudo cp server.key server.key.org
sudo openssl rsa -in server.key.org -out server.key
rm server.key.org
@pi0
pi0 / bug474.cpp
Last active September 26, 2015 20:05
Windows 10 Buffer overflow Exploit
/*
* Windows 10 kernel buffer overflow in NtGdiBitBlt PoC
* compile:
* cl.exe bug474.cpp user32.lib gdi32.lib shell32.lib
*/
#include <stdio.h>
#include <tchar.h>
#include <Windows.h>
#include <time.h>
@pi0
pi0 / User.php
Last active June 26, 2016 21:58
Laravel Mongo User Model
<?php
namespace App;
use Illuminate\Auth\Authenticatable;
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
use Illuminate\Foundation\Auth\Access\Authorizable;
@pi0
pi0 / docker-clean.sh
Created July 6, 2016 11:40
Cleanup Docker Storage
# http://stackoverflow.com/questions/30604846/docker-error-no-space-left-on-device
## Delete the orphaned volumes in Docker
docker volume rm $(docker volume ls -qf dangling=true)
## Remove all the unused Images.
docker rmi $(docker images | grep "^<none>" | awk "{print $3}")
@pi0
pi0 / docker-nginx-export.sh
Last active July 9, 2016 21:36
Export Docker Compose Nginx Logs
docker logs nginx_nginx_1 | grep -Po "(?<=nginx.1 \|.....).*" | pv > ~/nginx.log
keytool -genkey -v -keystore release.keystore -alias baziness -keyalg RSA -keysize 2048 -validity 10000
@pi0
pi0 / convoy.service
Created July 19, 2016 21:08
Convoy Systemctl Service File
[Unit]
Description=Convoy Daemon
Requires=docker.service
[Service]
ExecStart=/usr/local/bin/convoy daemon
[Install]
WantedBy=multi-user.target
@pi0
pi0 / vg-extend.sh
Last active September 16, 2016 21:30
pvcreate /dev/sda3
vgextend localhost-vg /dev/sda3
vgdisplay
lvextend -l +100%FREE /dev/mapper/localhost--vg-root
resize2fs /dev/mapper/localhost--vg-root
df -h