Skip to content

Instantly share code, notes, and snippets.

View mudassaralichouhan's full-sized avatar
:octocat:
It’s not a bug; it’s an undocumented feature.

Mudassar Ali mudassaralichouhan

:octocat:
It’s not a bug; it’s an undocumented feature.
View GitHub Profile
@stealth35
stealth35 / WebSocket.php
Created June 5, 2011 17:47
PHP WebSocket
<?php
class WebSocket
{
protected $url;
protected $protocols;
protected $socket;
public function __construct($url, $protocols = array())
{
$this->url = $url;
@oriolrivera
oriolrivera / index.php
Created June 22, 2015 06:16
Simple Chat Using WebSocket and PHP Socket
<!DOCTYPE html>
<html>
<head>
<meta charset='UTF-8' />
<style type="text/css">
<!--
.chat_wrapper {
width: 500px;
margin-right: auto;
margin-left: auto;
@fruitl00p
fruitl00p / bench.php
Created October 13, 2016 08:58
gzdeflate / gzcompress / gzencode
<?php
// GLOBALS available: $db, $currentImplementation, $currentUser, $currentSite, $currentPage
// PARAMS available: $sqlArray (array), $request (Web_request)
//
// GLOBALS available: $db, $currentImplementation, $currentUser, $currentSite, $currentPage
// PARAMS available: $sqlArray (array), $request (Web_request)
//
$string = 'thisismystringthisismystringthisismystringthisismystringthisis'
. 'mystringthisismystringthisismystringthisismystringthisismystringthisismystringthisismystringthisismystringthisismystringthis'
. 'ismystringthisismystringthisismystringthisismystringthisismystringthisismystringthisismystringthisismystringthisismystringth'
@m0veax
m0veax / websocket-check.php
Last active February 13, 2023 17:20 — forked from htp/curl-websocket.sh
Test a WebSocket using php fsockopen, bit chaotic, but working for me. You can use that for a HTTP Sensor in PRTG or Nagios
<?php
error_reporting(-1);
$host = "your-host.tld"; // your websocket url without protocol part
$SecWebsocketKey = "your key from websocket connection"; // try wireshark or developer Tools to get this
$origin = "http://$host/"; // origin for the header
$host = 'localhost'; //where is the websocket server
@yosko
yosko / Dom2Array.php
Last active March 28, 2023 23:41
Dom2Array converts a DOMDocument object to a PHP array. Array2Dom just does the opposite
<?php
/**
* Recursive function to turn a DOMDocument element to an array
* @param DOMDocument $root the document (might also be a DOMElement/DOMNode?)
*/
function Dom2Array($root) {
$array = array();
//list attributes
@ghassani
ghassani / QueryBuilder.php
Created September 19, 2018 18:28
Simple PHP SQL Query Builder for PDO
<?php
class QueryBuilder {
const QUERY_SELECT = 1;
const QUERY_INSERT = 2;
const QUERY_UPDATE = 3;
const QUERY_DELETE = 4;
const QUERY_REPLACE = 5;
const PARAMETER_STRING = 1;
@ayan-b
ayan-b / c-cpp-oops.md
Last active January 24, 2024 19:27
C, C++ & OOPS for Interviews
@asimshankar
asimshankar / README.md
Last active January 28, 2024 17:24
Training TensorFlow models in C++

Training TensorFlow models in C++

Python is the primary language in which TensorFlow models are typically developed and trained. TensorFlow does have bindings for other programming languages. These bindings have the low-level primitives that are required to build a more complete API, however, lack much of the higher-level API richness of the Python bindings, particularly for defining the model structure.

This file demonstrates taking a model (a TensorFlow graph) created by a Python program and running the training loop in C++.

@jpneey
jpneey / util.session.php
Last active January 30, 2024 13:10
Session Helper Class to handle sessions in PHP consistently
<?php
/**
* Basic Session Helper Class
*
* A simple helper class for handling session consistently
*
* Usage Example:
* <?php
* require 'path/to/util.session.php';
@wildiney
wildiney / bearer-token.php
Last active February 11, 2024 18:55
[deprecated] PHP - How to get and set Bearer Token
<?php
/**
* ALERT! There are more than ten years since I wrote the first version (adaptation) of this code with PHP 5.6,
* then I changed my code stack and I couldn't mantain this code anymore. Ten years ago worked like a charm.
* Fell free to test, use, fork, update, etc. and if possible put in the comments how to fix,
* if it doesn't work for you as it is, so other people could find answers.
**/
/**
* Get hearder Authorization