Skip to content

Instantly share code, notes, and snippets.

<?php
$data_json = json_encode(array('one','two','three','four','five','six','seven','eight','nine'));
$data_with_delimiter = "one|two|three|four|five|six|seven|eight|nine";
/*
|------------------------------------------------------------------------------
| Performance test # 1
|------------------------------------------------------------------------------
*/
@PEKTOP
PEKTOP / create_swap_1g.sh
Created August 15, 2014 19:57
Create SWAP 1Gb
#!/bin/bash
if [ ! -f /swapfile ]; then
sudo fallocate -l 1G /swapfile
echo -e "\e[32mSWAP file created.\e[39m"
else
echo -e "\e[33mSWAP file already exist.\e[39m"
fi
if ! [[ `swapon -s | grep /swapfile` ]]; then
@PEKTOP
PEKTOP / create_user_for_every_database.php
Created November 18, 2014 19:54
Create granted user for every mysql database
<?php
$dns = 'mysql:dbname=mysql;host=localhost';
$db_user = 'root';
$db_password = 'admin';
$db_handler = new PDO($dns, $db_user, $db_password);
$statment = $db_handler->query('SHOW DATABASES');
$dbs = $statment->fetchAll();
@PEKTOP
PEKTOP / Slug.php
Last active August 29, 2015 14:13
Slug
<?php
class Slug
{
/**
* @param string $string
* @return string
*/
public function make($string)
{
@PEKTOP
PEKTOP / VerifyEmail.php
Last active October 30, 2020 00:46
Verify Email address
<?php
use RuntimeException;
class VerifyEmail
{
/**
* @var string
*/
protected $email_user = '';
@PEKTOP
PEKTOP / laravel_lumen_build.sh
Last active November 14, 2015 13:05
Build automation for Laravel and Lumen
#!/bin/bash
echo "[BUILD] start"
CURRENT_DIR="$( cd "$( dirname "$0" )" && pwd )"
echo "[BUILD] current directory is $CURRENT_DIR"
if ! command -v php >/dev/null; then
echo "[BUILD] php is required"
echo "[BUILD] finish"
exit 1
@PEKTOP
PEKTOP / frontendDevlopmentBookmarks.md
Created December 3, 2015 10:02 — forked from dypsilon/frontendDevlopmentBookmarks.md
A badass list of frontend development resources I collected over time.
@PEKTOP
PEKTOP / postgres_helper.txt
Last active January 27, 2016 11:03
A Cheat Sheet
POSTGRESQL
$ sudo su postgres -c psql postgres
postgres=# ALTER USER postgres WITH PASSWORD 'password';
postgres=# \q
$ sudo passwd -d postgres
$ sudo su postgres -c passwd
@PEKTOP
PEKTOP / multpliers.py
Last active June 1, 2017 09:24
coin32
def multipliers():
return [(lambda y: (lambda x: x * y))(i) for i in range(4)]
print [m(2) for m in multipliers()]