Skip to content

Instantly share code, notes, and snippets.

AbiusX abiusx

Block or report user

Report or block abiusx

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@abiusx
abiusx / youtube-updater.php
Created Dec 10, 2018
Youtube Video Updater in Pure PHP
View youtube-updater.php
<?php
/**
* This script can be used to modify videos on Youtube programatically.
* It does not need Google API libraries, it merely uses PHP's CURL.
*
* Before starting to work with this, read the comments below for oAuth_token()
* function. It requires you do 3 steps (twice run this code while uncommenting,
* once login on your browser). Once you have done that and updated the constants
* below, you're good to go!
@abiusx
abiusx / 2018tax.php
Created Oct 30, 2018
2018 Wage/Self-Employment/Dividend/Investment Tax Calculator (Also Solves for S Corp Optimum Dividend/Salary)
View 2018tax.php
<?php
/**
* @author AbiusX <me@abiusx.com>
* @version 1.0
*/
/**
* Calculate taxes based on salary, self-employment salary,
* dividends and capital gains. Especially useful for S Corps
*
@abiusx
abiusx / twilio_captcha.php
Created Sep 27, 2018
Phone voice call captcha powered by Twilio and TwiML (also forwards SMS)
View twilio_captcha.php
<?php
/**
* Call captcha to prevent spam calls
* Uses Twilio TwiML syntax
* @author abiusx
* @version 1.1
*/
$name="John Doe"; // Put your name here
$number="+14342904141"; // Put your real phone number here
@abiusx
abiusx / array_key_map.php
Last active Aug 23, 2018
PHP's array_map, but instead of mapping values, maps keys.
View array_key_map.php
<?php
/**
* Array map, but maps values to new keys instead of new values
* @return array same arrays with keys mapped
*/
function array_map_key($callback,$array)
{
$out=array_reduce($array, function ($carry,$val) use ($array,$callback){
$key=call_user_func($callback,$val);
$carry[$key]=$val;
@abiusx
abiusx / docker-php.sh
Last active Sep 16, 2018
Quick PHP-Apache Docker environment
View docker-php.sh
#!/bin/sh
if [[ $# -lt 1 ]]; then
echo "Usage: $0 NAME [PORT]";
exit 1
fi
NAME=$1
PORT=${2:-80}
if [ "${PWD##*/}" != "${NAME}" ]; then
mkdir -p "${NAME}"
cd "${NAME}"
@abiusx
abiusx / latency.txt
Created Feb 20, 2018 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
View latency.txt
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
View honeypot_ls.sh
#!/bin/bash
LOGFILE="/tmp/lslog"
ORIGINAL_LS="/bin/LS"
#chmod 777 "${LOGFILE}"
WHOAMI=$(whoami)
TTY=$(tty)
CWD="$(pwd)"
PARENT_COMMAND="$(ps -o comm= $PPID)"
@abiusx
abiusx / stdlib.php
Last active Apr 17, 2017
Standard PHP Library
View stdlib.php
<?php
function grep_r($str,$find)
{
return substr($str,$r=strpos($str,$find)+strlen($find),strpos($str,PHP_EOL,$r)-1-$r);
}
function curl($url,$postparams=[],$headers=[],$additional_opts=[])
{
$opts=[
CURLOPT_COOKIEJAR => 'stdlib.cookie',
CURLOPT_COOKIEFILE => 'stdlib.cookie',
@abiusx
abiusx / typed_php.php
Last active Aug 30, 2016
Type Checked PHP (methods, functions are not yet supported)
View typed_php.php
<?php
class TypedPHPException extends Exception {
function __construct($msg,$file,$line)
{
parent::__construct($msg);
$this->file=$file;
$this->line=$line;
}
}
@abiusx
abiusx / zval_id.phpx
Created Apr 25, 2016
An implementation of zval_id in C for PHP extensions
View zval_id.phpx
ZEND_BEGIN_ARG_INFO_EX(phpx_byref_arginfo,
1 /*pass_rest_by_reference*/,
0/*return_reference*/,
1/*required_num_args*/)
ZEND_ARG_PASS_INFO(1/*by_ref*/)
ZEND_END_ARG_INFO();
PHP_FUNCTION(zval_id)
{
//computes the address of first zval sent to it,
You can’t perform that action at this time.