Skip to content

Instantly share code, notes, and snippets.

Dumitru Uzun duzun

Block or report user

Report or block duzun

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
@duzun
duzun / php_sess_to_redis.sh
Last active Jul 4, 2019
Bash script to import PHP session files into redis
View php_sess_to_redis.sh
#!/bin/bash
export REDISCLI_AUTH=my-supper-strong-password-4-redis-server
TTL=$(( 24 * 3600 ))
# cd "/var/sess"
for i in sess_*; do
ex=$(( $(date +%s) - $(stat -c %Y "$i") + $TTL ))
@duzun
duzun / fix_lib_links.sh
Created Dec 25, 2018
Fix /usr/lib/lib*.so links, in the case you `cp`ed lib folder from a backup (use `rsync -a`, not `cp`!)
View fix_lib_links.sh
@duzun
duzun / cron_eye_safe.sh
Last active Aug 6, 2018
Install notifications every 20 min and 2 hours to rest your eyes - KDE on Linux
View cron_eye_safe.sh
#!/bin/sh
#
# Keep your eyes safe on cron
#
# @author Dumitru Uzun (DUzun.Me)
# @web https://gist.github.com/duzun/99bd0d1cba6c8ad1b5bf321c2689a257
#
_user=${USER:-$(whoami)}
@duzun
duzun / findByKey.php
Last active Feb 7, 2018
Find a value in an array by key recursively
View findByKey.php
<?php
// Note:
// Whether $list contains a NULL value for $needle at some level, or there is no $needle at all,
// in both cases this function returns NULL.
// If you want to find non-NULL $needle only, replace `array_key_exists` with `isset`
function findByKey($list, $needle) {
$stack = [$list];
while( !empty($stack) ) {
@duzun
duzun / Dockerfile
Created Aug 29, 2017
SSHD for Alpine container
View Dockerfile
FROM httpd:2.4-alpine
# SSHD #################################
RUN apk update && \
apk add openssh augeas && \
mkdir -p ~root/.ssh /etc/authorized_keys && chmod 700 ~root/.ssh/ && \
augtool 'set /files/etc/ssh/sshd_config/AuthorizedKeysFile ".ssh/authorized_keys /etc/authorized_keys/%u"' && \
augtool 'set /files/etc/ssh/sshd_config/PermitRootLogin yes' && \
augtool 'set /files/etc/ssh/sshd_config/PasswordAuthentication yes' && \
augtool 'set /files/etc/ssh/sshd_config/Port 22' && \
@duzun
duzun / arch_enable_bbr.sh
Last active Dec 20, 2018
Enable TCP BBR
View arch_enable_bbr.sh
#!/bin/bash
#
# A script to enable TCP BBR on a Linux system.
#
# @author Dumitru Uzun (DUzun.Me)
# @version 1.0.0
# @distro ArchLinux/Manjaro
#
old_cc=`sysctl net.ipv4.tcp_congestion_control | awk -F= '{print $2}' | sed -e s/\^\\s//`
@duzun
duzun / psmem
Created Mar 15, 2017
Process Memory consumption - Linux
View psmem
#!/bin/bash
#############################################
# Process Memory consumption #
# #
# Usage: psmem <process_name> [<user_grep>] #
# psmem nginx #
# psmem php5-fpm www-data #
# #
# Author: Dumitru Uzun (DUzun.me) #
@duzun
duzun / вопросы-для-IT-собеседования Нормальные вопросы для IT-собеседования
View вопросы-для-IT-собеседования
Вы ранее привлекались за хранение данных в глобальных переменных?
Вы когда-нибудь делали .Net за деньги?
Сформулируйте зависимость времени исправления критического бага от seniority присутствующего менеджера
В своём резюме вы указали знание php. вам не стыдно?
Перед вами кисть, холст и мольберт. напишите компилятор
@duzun
duzun / clone-es5.js
Created Jul 8, 2016 — forked from jherax/clone.js
JavaScript: clona o extiende un objeto
View clone-es5.js
/**
* Creates a deep copy of an object
* @param {Any} from: Source object to clone
* @param {Object} dest: (Optional) destination object to merge with
* @return {Any} The cloned object
*/
var clone = (function() {
var _toString = Object.prototype.toString;
function _clone (from, dest, objectsCache) {
@duzun
duzun / ocp.php
Created Jun 7, 2016 — forked from ck-on/ocp.php
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP)#ocp #php #opcache #opcode #cache #zend #optimizerplus #optimizer+
View ocp.php
<?php
/*
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP)
Author: _ck_ (with contributions by GK, stasilok)
Version: 0.1.7
Free for any kind of use or modification, I am not responsible for anything, please share your improvements
* revision history
0.1.7 2015-09-01 regex fix for PHP7 phpinfo
0.1.6 2013-04-12 moved meta to footer so graphs can be higher and reduce clutter
You can’t perform that action at this time.