Skip to content

Instantly share code, notes, and snippets.

@hjpotter92
hjpotter92 / gist:9802333
Last active August 29, 2015 13:57
hashes
d49fb3538ee71a430123
ea9e0d6b9053a8b1367b
math.randomseed( os.time() )
local Random, Read, Write = math.random, io.read, io.write
Write "Number of players -> "
local tPlayers, iNumPlayers = {}, Read '*n'
Write "How many rounds? -> "
local iRounds = Read '*n'
io.input():flush()
@hjpotter92
hjpotter92 / auto-comment.json
Last active December 15, 2015 06:49
JSON view of auto comment section.
callback(
[
{ "name": "Answers just to say Thanks!", "description": "Please don't add \"thanks\" as answers. Invest some time in the site and you will gain sufficient <a href=\"http://$SITEURL$/privileges\">privileges</a> to upvote answers you like, which is the $SITENAME$ way of saying thank you."},
{ "name": "Nothing but a URL (and isn't spam)", "description": "Whilst this may theoretically answer the question, <a href=\"http://meta.stackoverflow.com/q/8259\">it would be preferable</a> to include the essential parts of the answer here, and provide the link for reference."},
{ "name": "Requests to OP for further information", "description": "This is really a comment, not an answer. With a bit more rep, <a href=\"http://$SITEURL$/privileges/comment\">you will be able to post comments</a>. For the moment I've added the comment for you, and I'm flagging this post for deletion."},
{ "name": "OP using an answer for further information", "description": "Please use the <em>Post answer</em> button only for actual
@hjpotter92
hjpotter92 / PROPOSAL.md
Last active December 16, 2015 15:59
My Google Summer of Code 2013 proposal.

[GSoC-2013] Introduce PDO for MySQL

I would like to implement the PDO methods to the current DBAL. Most likely, I'll create it from scratch as it'll help in the later stages of overall development. I am aware that this is a huge project and breaking it into parts which can be completed/shown in the GSoC duration of 3 months is difficult.

Idea

My idea is an extension of existing RFC discussion [here][1] ( [http://area51.phpbb.com/phpBB/viewtopic.php?f=108&t=32883][2] ). As PDO is bundled with PHP itself, a lot of duplication in current DBAL used for phpBB can be reduced. Prepared statements provide a lot of flexibility too.

Benefits

  • PDO can be used to maintain FreeTDS/Microsoft SQL Server/Sybase, Firebird/Interbase 6, MySQL 3.x/4.x/5.x, PostgreSQL, SQLite 3 and SQLite 2, Microsoft SQL Server/SQL Azure and a lot of others(with active support for all of them).
  • Exceptions and error handling is easier(with the PDOException class).
@hjpotter92
hjpotter92 / Program01.asm
Last active December 20, 2015 20:38
Take a number as input and print it To be shown on 2013-08-12
TITLE Program01: Take a number as input and print it
.MODEL SMALL
.STACK 100H
.DATA
PROMPT DB "Please input the number: ", 13, 10, '$'
CR EQU 13
LF EQU 10
TITLE Sort: Program to sort numbers as they are inputted by user
.MODEL SMALL
.STACK 100H
.DATA
MyARR DW 200 DUP(?)
PROMPT DB 10, 13, "Input number? (Press N to quit): $"
SEP DB ", $"
LST DB 10, 13, "Current array has: $"
CR EQU 13
@hjpotter92
hjpotter92 / assignment.asm
Created August 27, 2013 16:53
2013-08-26: Systems programming lab assignment.
TITLE Lab05: Read array of integers and display recurring elements
.MODEL SMALL
.STACK 100H
.DATA
CR EQU 13
LF EQU 10
@hjpotter92
hjpotter92 / DISPSTR.asm
Last active December 22, 2015 16:09
2013-09-09: Read two strings and check whether one of them is a subtring of other or not
DISP_STR PROC
SAVE_REG <AX, CX, DX, SI>
MOV CX, BX
CLD
MOV AH, 2
DISP_LOOP:
LODSB
MOV DL, AL
INT 21H
ADD 111
SUB 112
MOV 113
XOR 114
CMP 115
@hjpotter92
hjpotter92 / .rcbash
Last active May 23, 2016 08:12
Git Bash profile settings.
source ~/git-prompt.sh
source ~/git-completion.bash
export GIT_PS1_SHOWDIRTYSTATE=true
export GIT_PS1_SHOWUNTRACKEDFILES=true
export GIT_PS1_SHOWSTASHSTATE=true
export GIT_PS1_SHOWUPSTREAM=verbose
PS1=$'\[\e[0m\]\u250c\u2500[$([[ $? != 0 ]] && echo "\[\e[1;31m\]\u2717\[\e[0m\]" || echo "\[\e[1;32m\]\u2714\[\e[0m\]")]\u2500[\[\e[0m\]\[\e[1;36m\]\u\[\e[0m\]@\[\e[1;35m\]\h\[\e[0m\]]\u2500[\[\e[4;33m\]\W\[\e[0m\]]\u2500[\[\e[1;33m\]\@\[\e[0m\]]\[\e[0m\]$(__git_ps1)\n\[\e[0m\]\u2514\u2500\u2500\[\e[1;36m\]\$\[\e[0m\] '
# custom alias list
# ls, clear etc.