Skip to content

Instantly share code, notes, and snippets.

@m7shapan
m7shapan / Dockerfile
Created April 10, 2021 22:25
Redis Dockerfile
FROM redis
COPY ./redis.conf /usr/local/etc/redis/redis.conf
CMD [ "redis-server", "/usr/local/etc/redis/redis.conf" ]
@m7shapan
m7shapan / redis.conf
Created April 10, 2021 22:25
maxmemory policy for Redis conf
maxmemory-policy allkeys-lfu
@m7shapan
m7shapan / weather.go
Created June 30, 2020 08:23
How to use NJSON Example
package main
import (
"encoding/json"
"fmt"
"github.com/m7shapan/njson"
)
var jsonString string = `
@m7shapan
m7shapan / task.php
Created May 4, 2019 16:05
get 3rd lowest number
<?php
$numbers = [1, 4, 5, 10, 3, 2, 5, 8, 11];
$isThereLower = 0;
$tmp = 0;
for ($i = 1; $i < count($numbers); $i++) {
if ($numbers[$i] < $numbers[$tmp]) {
$isThereLower++;
@m7shapan
m7shapan / MySqlConnection.py
Created March 6, 2017 10:20
connect to MySql DB python
import MySQLdb
import MySQLdb.cursors
sql_db = MySQLdb.connect(host="",user="",passwd="",db="",cursorclass=MySQLdb.cursors.DictCursor)
cursor = sql_db.cursor()
domainsCount = cursor.execute("SELECT * FROM domains where ...")
print cursor.fetchall()
@m7shapan
m7shapan / default
Created January 26, 2017 02:46
default configuration for nginx for using .dev in you project
server {
index index.html index.php;
set $basepath "/mnt/7282B48E0BE626E0/www/html";
set $domain $host;
# check one name domain for simple application
if ($domain ~ "^(.[^.]*)\.dev$") {
set $domain $1;
set $rootpath "${domain}/public";
@m7shapan
m7shapan / word.php
Created September 22, 2016 14:44
header
$phpWord = new \PhpOffice\PhpWord\PhpWord();
$section = $phpWord->addSection();
$section->addImage(
'105067.jpg',
array(
'width' => 100,
'height' => 100,
'marginTop' => -1,