Skip to content

Instantly share code, notes, and snippets.

IDCT Software Development ideaconnect

Block or report user

Report or block ideaconnect

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
View multibyte-unserialize.php
<?php
function mb_unserialize($string) {
$string = preg_replace_callback('#s:\d+:"(.*?)";#s', function($matches) { return sprintf('s:%d:"%s";', strlen($matches[1]), $matches[1]); }, $string);
return unserialize($string);
}
@ideaconnect
ideaconnect / wykoptagstat.php
Created Aug 26, 2018
Lists stats for major cities on Wykop.pl
View wykoptagstat.php
<?php
$data = file_get_contents('https://stat.gov.pl/statystyka-regionalna/rankingi-statystyczne/miasta-najwieksze-pod-wzgledem-liczby-ludnosci/');
$matches = [];
preg_match_all('/<td style="text-align: left;">(M\.st\.){0,1}(.*?)(&nbsp;){0,1}<\/td>/is', $data, $matches);
$tags = [];
$cityRank = [];
$i = 0;
foreach ($matches[2] as $city) {
$cityname = strtolower(iconv('utf8', 'ascii//TRANSLIT', str_replace([' ', '-'], ['', ''], $city)));
$cityRank[$cityname] = ++$i;
View wykop-notifs.php
<?php
/**
* Simple method which performs a login operation to Polish reddit-like "wykop.pl"
* and fetches the number of notifications.
*
* @todo This is made just for fun! My activity on the websites was too low to
* be granted access to Wykop API.
*
* @param string $operation token, login, notifs
* @param string $username
View inpost-test.php
function getStatus($num) {
$query = "curl 'https://tracking.inpost.pl/api/v1/history/package\[0\]=".$num."?_=".time()."' -H 'Origin: https://twoj.inpost.pl' -H 'Accept-Encoding: gzip, deflate, br' -H 'Accept-Language: pl-PL,pl;q=0.9,en-US;q=0.8,en;q=0.7' -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36' -H 'Accept: */*' -H 'Referer: https://twoj.inpost.pl/pl/znajdz-przesylke?parcel=".$num."' -H 'Connection: keep-alive' --compressed 2>/dev/null";
$data = shell_exec($query);
return json_decode($data, true);
}
function reportPackageInfo($num) {
$status = getStatus($num);
if (!$status || $status == 'Error') {
echo $num . ' -- brak' . PHP_EOL;
@ideaconnect
ideaconnect / leibniz.php
Created Mar 14, 2017
Leibniz formula for Pi calculation implementation
View leibniz.php
<?php
$complexity = 1000000;
$decimals = 50;
bcscale($decimals);
$num = 0;
for ($i =0; $i < $complexity; $i++) {
$num = bcadd($num, bcdiv(pow(-1, $i), bcadd(1, bcmul(2, $i) )));
}
echo bcmul(4, $num);
View runner.php
<?php
const BUMPER_FR = 23;
const BUMPER_FL = 24;
const BUMPER_RR = 22;
const BUMPER_RL = 25;
const E_R_F = 4;
const E_R_B = 1;
const E_L_F = 5;
View robot.php
<?php
const BUMPER_FR = 23;
const BUMPER_FL = 24;
const BUMPER_RR = 22;
const BUMPER_RL = 25;
const E_R_F = 4;
const E_R_B = 1;
const E_L_F = 5;
View Downloader.php
<?php
namespace Casadatos\Component\Downloader;
use Casadatos\Component\Downloader\Exception\HttpException;
use Zend\Http\Client;
use Zend\Http\Headers;
use Zend\Http\Request;
use Zend\Http\Response;
use Melihucar\FtpClient\FtpClient;
View connection.php
<?php
include "vendor/autoload.php";
include "Exception/HttpException.php";
include "Downloader.php";
$downloader = new Casadatos\Component\Downloader\Downloader();
$headers = new Zend\Http\Headers();
$headers->addHeaderLine("Accept-Encoding", "gzip")
->addHeaderLine("Content-Encoding", "gzip")
View mixed_oop.cpp
#include <iostream>
using namespace std;
void echotest() {
cout << "echo out of class\r\n";
}
class with_method_inside {
public:
You can’t perform that action at this time.