This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$arr = array( | |
0 => array("href" => "google.com", "text" => "Google"), | |
1 => array("href" => "ya.ru", "text" => "Yandex"), | |
2 => array("href" => "google.com", "text" => "Google RU"), | |
3 => array("href" => "google.com", "text" => "Google"), | |
); | |
$str = array(); | |
$some = array(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
mb_internal_encoding('UTF-8'); | |
$input = 'привет, мир. я программист PHP. это правда! не вру!'; | |
function text($input) | |
{ | |
return preg_replace_callback('#((?:[.!?]|^)\s*)(\w)#us', function($matches) { | |
return $matches[1] . mb_strtoupper($matches[2]); | |
}, $input); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$text = 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.'; | |
function getWordsCountEndsWith($letter, $text) | |
{ | |
return preg_match_all('#' . preg_quote($letter, '#') . '\b#usi', $text); | |
} | |
function getWordsCountStartsWith($letter, $text) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class DB { | |
public static function connectDb() | |
{ | |
$host = 'localhost'; | |
$dbname = 'hhahh'; | |
$user = 'hhahh'; | |
$password = 'hhahh'; | |
$db = new PDO("mysql:host=$host;dbname=$dbname", $user, $password); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# Sums of Digits | |
# Algorythm and code | |
# By Mr CaT | |
# Copyright (c) 2017 | |
function fix($a,$b,$c) | |
{ | |
global $d; # Our global var, will be $d | |
$d = $a * $b + $c; # D is a * b and plus c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$token = ''; | |
$last_offset_filename = 'last_offset.txt'; | |
$last_offset = file_exists($last_offset_filename) ? file_get_contents($last_offset_filename) : '0'; | |
$ch = curl_init(); | |
curl_setopt_array($ch, [ | |
CURLOPT_SSL_VERIFYPEER => 0, | |
CURLOPT_SSL_VERIFYHOST => 0, | |
CURLOPT_HEADER => 0, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# Function of sums of digits | |
def solve(a,b,c): | |
d=a*b+c | |
result=list(map(int,str(d)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from kombu import Connection, Exchange, Queue | |
from kombu.pools import connections | |
class AmqpStore(Store): | |
name = 'amqp' | |
def configure(self, cfg, logger): | |
url = cfg.var('ITEM_STORE_URL') | |
self.logger = logger |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python2 | |
import sys | |
from pwn import * | |
def find_libc_path_and_offset(): | |
with open("/proc/self/maps") as f: | |
for line in f: | |
line = line.strip() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import socket, sys, re | |
from time import sleep | |
s = socket.socket() | |
s.connect((sys.argv[1], 6666)) # connect to service, ip in first script arg | |
# Recv until string occurs | |
def recv_until(s, st): | |
buf = '' | |
while True: |
OlderNewer