Skip to content

Instantly share code, notes, and snippets.

View rannieo's full-sized avatar
🎯
Doing nice things.

Rannie Ollit rannieo

🎯
Doing nice things.
View GitHub Profile
@rannieo
rannieo / gist:4f8c3054448157db14daf608f35715be
Created October 25, 2021 07:23 — forked from kitek/gist:1579117
NodeJS create md5 hash from string
var data = "do shash'owania";
var crypto = require('crypto');
crypto.createHash('md5').update(data).digest("hex");
<?php
//answer for https://www.testdome.com/questions/php/file-owners/11840?visibility=17&skillId=5
class FileOwners
{
public static function groupByOwners($files)
{
$result=array();
foreach($files as $key=>$value)
{
$result[$value][]=$key;
@rannieo
rannieo / README.md
Created September 8, 2021 09:01 — forked from hakre/README.md

Extend from SoapClient Examples

Just a collection gist of some assorted example SOAPClients. Code must not be stable or useful under all circumstances, these are examples. Most of the code is outdated, so you won't need to use it any longer in production code. I've just collected and compiled this together out of interest, the information normally is scattered around.

If you need to a start with PHP's SOAPClient start with the PHP manual page of it and read through the comments as well. Double check with exisiting bug-reports if given as many things are fixed since a comment was left.

@rannieo
rannieo / hmac-sha512.js
Created August 25, 2021 13:14
HMAC SHA512 Encryption
var crypto = require("crypto");
function encrypt(key, str) {
var hmac = crypto.createHmac("sha512", key);
var signed = hmac.update(new Buffer(str, 'utf-8')).digest("base64");
return signed
}
@rannieo
rannieo / IERC20.sol
Last active August 15, 2022 11:46
ERC20 Token standard
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
@rannieo
rannieo / Oci8ServiceProvider.php
Last active July 8, 2021 06:57
Override OCI_CRED_EXT error in laravel-oci8 by yajra
<?php
namespace App\Providers;
use Illuminate\Database\Connection;
use Yajra\Oci8\Oci8ServiceProvider as ServiceProvider;
use App\Connectors\OracleConnector as Connector;
use Yajra\Oci8\Oci8Connection;
class Oci8ServiceProvider extends ServiceProvider
@rannieo
rannieo / ActivityLogController.php
Last active July 7, 2021 02:46
Pipeline Pattern in Laravel (Queries)
<?php
namespace App\Http\Controllers\API;
use App\Http\Controllers\Controller;
use App\Models\ActivityLog;
use App\QueryFilters\FilterByUser;
use Illuminate\Http\Request;
use Illuminate\Pipeline\Pipeline;
const axios = require('axios').default;
axios.interceptors.request.use(x => {
const headers = {
...x.headers.common,
...x.headers[x.method],
...x.headers
};
@rannieo
rannieo / startup.sh
Created May 13, 2021 05:58
Get certificate authorities installed in Ubuntu Machine
awk -v cmd='openssl x509 -noout -subject' '
/BEGIN/{close(cmd)};{print | cmd}' < /etc/ssl/certs/ca-certificates.crt
@rannieo
rannieo / sqlsrv-php7.2.sh
Created May 10, 2021 06:33 — forked from LegitDongo/sqlsrv-php.sh
SQLSRV PHP 7.2 Drivers that work for Laravel Homestead
# Best if added to `after.sh` so that this gets run every time the box is provisioned
# composer won't be able to download updates with an active proxy, and will hang trying to get the newest file
# You may want to comment this out based on your network configuration
sudo bash -c 'echo "export NO_PROXY=*" >> ~/.profile'
sudo add-apt-repository ppa:ondrej/php -y
sudo apt-get update
sudo apt-get install php7.2-dev php7.2-xml mcrypt php-pear php-mbstring unixodbc unixodbc-dev -y --allow-unauthenticated