Skip to content

Instantly share code, notes, and snippets.

View arabcoders's full-sized avatar

Abdulmohsen arabcoders

View GitHub Profile
@arabcoders
arabcoders / widevine-decryption.md
Created April 12, 2025 16:18 — forked from frozenpandaman/widevine-decryption.md
download videos protected with widevine DRM
@arabcoders
arabcoders / blur_detector
Created May 31, 2020 03:47 — forked from pceres/blur_detector
blurry photos detection
#! /bin/bash
#
# Author: Pasquale Ceres ([email protected])
# License: GPL ver. 3
#
# Script originally developed for the
# "San Lorenzo Martire Caposele Church Records Digitalization Project"
#
# http://www.facebook.com/group.php?gid=188973755117&v=photos
@arabcoders
arabcoders / tar.gz with gpg-encryption on the fly
Created June 10, 2017 19:01 — forked from revnode/tar.gz with gpg-encryption on the fly
Create a encrypted tar.gz file from a directory on the fly. The encryption is done by GPG with a public key. The resulting filename is tagged with the date of creation. Very usefull for encrypted snapshots of folders.
tar -cvz /<path>/ | gpg --encrypt --recipient <keyID> > /<backup-path>/backup_`date +%d_%m_%Y`.tar.gz.gpg
@arabcoders
arabcoders / post-mortem.md
Created April 12, 2017 17:28 — forked from joewiz/post-mortem.md
Recovery from nginx "Too many open files" error on Amazon AWS Linux

On Tue Oct 27, 2015, history.state.gov began buckling under load, intermittently issuing 500 errors. Nginx's error log was sprinkled with the following errors:

2015/10/27 21:48:36 [crit] 2475#0: accept4() failed (24: Too many open files) 2015/10/27 21:48:36 [alert] 2475#0: *7163915 socket() failed (24: Too many open files) while connecting to upstream...

An article at http://www.cyberciti.biz/faq/linux-unix-nginx-too-many-open-files/ provided directions that mostly worked. Below are the steps we followed. The steps that diverged from the article's directions are marked with an *.

    • Instead of using su to run ulimit on the nginx account, use ps aux | grep nginx to locate nginx's process IDs. Then query each process's file handle limits using cat /proc/pid/limits (where pid is the process id retrieved from ps). (Note: sudo may be necessary on your system for the cat command here, depending on your system.)
  1. Added fs.file-max = 70000 to /etc/sysctl.conf
  2. Added `nginx soft nofile 1
@arabcoders
arabcoders / README.md
Created December 2, 2016 08:09 — forked from nikcub/README.md
Facebook PHP Source Code from August 2007
@arabcoders
arabcoders / converter.php
Created April 15, 2016 17:15 — forked from ShNURoK42/converter.php
Converter bbCode to markdown
protected function bbcode($bbcode)
{
$bbcode = str_replace("\n", " \n", $bbcode);
$bbcode = str_replace("[b]", "**", $bbcode);
$bbcode = str_replace("[/b]", "**", $bbcode);
$bbcode = str_replace("[i]", "*", $bbcode);
$bbcode = str_replace("[/i]", "*", $bbcode);
@arabcoders
arabcoders / post-receive.sh
Created September 30, 2015 19:31 — forked from ryansechrest/post-receive.sh
Git post-receive hook to deploy WordPress and plugins as submodules. It can also install Node.js modules with npm and vendor packages with Composer.
#!/bin/bash
# Created on 7/17/13 by Ryan Sechrest
# Deploys pushed branch from the origin repository to the web directory
if [[ (-n $1) && (-n $2) && (-n $3) ]]; then
# Set path to project directory
project_path="/var/www/domains/$2/$3"
<?php
class SecureSessionHandler extends SessionHandler {
protected $key, $name, $cookie;
public function __construct($key, $name = 'MY_SESSION', $cookie = [])
{
$this->key = $key;
$this->name = $name;
<?php
use PhpParser\Node;
use PhpParser\Node\Expr;
error_reporting(E_ALL);
ini_set('memory_limit', -1);
//$dir = __DIR__ . '/../../Symfony_2.3';
#!/bin/sh
#
# redis - this script starts and stops the redis-server daemon
#
# chkconfig: - 85 15
# description: Redis is a persistent key-value database
# processname: redis-server
# config: /etc/redis/redis.conf
# config: /etc/sysconfig/redis
# pidfile: /var/run/redis.pid