Skip to content

Instantly share code, notes, and snippets.

View phpdangerousfuncs.md

Command Execution

exec           - Returns last line of commands output
passthru       - Passes commands output directly to the browser
system         - Passes commands output directly to the browser and returns last line
shell_exec     - Returns commands output
\`\` (backticks) - Same as shell_exec()
popen          - Opens read or write pipe to process of a command
proc_open      - Similar to popen() but greater degree of control
pcntl_exec     - Executes a program
@magussiro
magussiro / shell_array.sh
Created Jul 17, 2020 — forked from jaceju/shell_array.sh
Shell Script 的陣列範例
View shell_array.sh
#!/bin/bash
versions=("5.6.24" "7.0.9")
function say()
{
value=$1
echo -e "php-$value\n"
}
@magussiro
magussiro / example.php
Created Jul 17, 2020 — forked from jaceju/example.php
物件導向基礎與物件導向設計入門
View example.php
<?php
abstract class Database
{
public function __construct()
{
$this->connect();
}
abstract public function connect();
@magussiro
magussiro / create_zf_project.sh
Created Jul 17, 2020 — forked from jaceju/create_zf_project.sh
利用專案樣版在 Subversion 中建立一個 Zend Framework 專案
View create_zf_project.sh
#!/bin/bash
# Program:
# 利用專案樣版在 Subversion 中建立一個 Zend Framework 專案
# History:
# 2011/11/03 Jace Ju First release
# Usage:
# Create template of project at first time:
# > cd /path/to/project_template
# > mkdir branches
# > mkdir tags
View Singleton.php
<?php
trait Singleton
{
protected static $_instance = null;
public static function getInstance()
{
if (static::$_instance === null
|| !(static::$_instance instanceof static)) {
@magussiro
magussiro / xss_notes.md
Created Jul 17, 2020 — forked from jaceju/xss_notes.md
XSS 上課筆記
View xss_notes.md

XSS 上課筆記

OWASP

  1. Injection
  2. Broken Authentication and Session Management
  3. XSS

Devcore

@magussiro
magussiro / Python3, Pip3, Virtualenv and Virtualenvwrapper Setup Setting up and using Python3, Pip3, Virtualenv (for Python3) and Virtualenvwrapper (for Python3)
View Python3, Pip3, Virtualenv and Virtualenvwrapper Setup
First install pip for Python2. Download the get-pip.py file from https://bootstrap.pypa.io/get-pip.py
$ cd <download location>
$ sudo -H python ./get-pip.py
Installing pip also installs Python3
To run Python3
$ python3
Install pip3 by just executing the same file as in the step above, but this time using Python3
$ sudo -H python3 ./get-pip.py
@magussiro
magussiro / httpserver.sh
Created Mar 21, 2020 — forked from upperstream/httpserver.sh
Simple HTTP Server (shell script)
View httpserver.sh
#!/bin/sh
#
# Copyright (C) 2017 Upper Stream.
#
# See the bottom of this file for licensing conditions.
#
#set -x
set -e
@magussiro
magussiro / Readme.txt
Created Aug 21, 2018 — forked from tony1223/Readme.txt
Generating iOS P12 / certs without Mac OSX Keychain (on linux, windows, etc)
View Readme.txt
1) Generate a private key and certificate signing request:
openssl genrsa -out ios_distribution.key 2048
openssl req -new -key ios_distribution.key -out ios_distribution.csr -subj '/emailAddress=me@example.com, CN=Example, C=US'
2) Upload CSR to apple at: https://developer.apple.com/account/ios/certificate/create
- choose Production -> App Store and Ad Hoc
3) Download the resulting ios_distribution.cer, and convert it to .pem format:
View falsehood-prices.md

Falsehoods programmers believe about prices

  1. You can store a price in a floating point variable.
  2. All currencies are subdivided in 1/100th units (like US dollar/cents, euro/eurocents etc.).
  3. All currencies are subdivided in decimal units (like dinar/fils)
  4. All currencies currently in circulation are subdivided in decimal units. (to exclude shillings, pennies) (counter-example: MGA)
  5. All currencies are subdivided. (counter-examples: KRW, COP, JPY... Or subdivisions can be deprecated.)
  6. Prices can't have more precision than the smaller sub-unit of the currency. (e.g. gas prices)
  7. For any currency you can have a price of 1. (ZWL)
  8. Every country has its own currency. (EUR is the best example, but also Franc CFA, etc.)