Skip to content

Instantly share code, notes, and snippets.

yushine yushine

View GitHub Profile
yushine / Crontab.class.php
Created Jun 19, 2018 — forked from GustavGenberg/Crontab.class.php
Easy crontab manager for PHP. Uses shell_exec!
View Crontab.class.php
class Crontab {
(c) Gustav Genberg 2017
This script uses PHP shell_exec! Make sure it is enabled before using!
Also make sure that the user running this script (usually www-data) have access to the crontab command!
yushine /
Last active Apr 14, 2018 — forked from w00fz/
PHP switcher
# Check if command was ran as root.
if [[ $(id -u) -eq 0 ]]; then
echo "The command \"sphp\" should not be executed as root or via sudo directly."
echo "When a service requires root access, you will be prompted for a password as needed."
exit 1
# Usage
yushine /
Created Jun 24, 2017 — forked from entropiae/
git: how to solve "SSLRead() return error -9806" in OSX using brew
$ brew remove git
$ brew remove curl
$ brew install openssl
$ brew install --with-openssl curl
$ brew install --with-brewed-curl --with-brewed-openssl git
View redis-server
# 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/
yushine / Encrypt.php
Created Jan 23, 2017 — forked from vishnukumarpv/Encrypt.php
Encrypt and Decrypt with php
View Encrypt.php
class Encrypt{
private function key( )
return $skey = "vishnu_kumar_aUlTIoQaBzk";
public function safe_b64encode($string) {
$data = base64_encode($string);
$data = str_replace(array('+','/','='),array('-','_',''),$data);
View gist:f15d421833275607de5dbcf0025c1ead
function encrypt($string, $key=5) {
$result = '';
for($i=0, $k= strlen($string); $i<$k; $i++) {
$char = substr($string, $i, 1);
$keychar = substr($key, ($i % strlen($key))-1, 1);
$char = chr(ord($char)+ord($keychar));
$result .= $char;
return base64_encode($result);
View gist:2834e8545e6515df3bdb1f66586e0f87
class encrypt
private $key;
private $uword;
private $eword;
private $letters;
yushine / Envoy.blade.php
Created Nov 1, 2016 — forked from joaosalless/Envoy.blade.php
Laravel Envoy Task Runner
View Envoy.blade.php
@servers(['staging' => 'root@', 'production' => 'root@'])
$app_name = 'l5eka';
$app_path = '/var/www/vhosts/'.$app_name;
$repo = '';
$branch = 'aula4';
$github_token = ''; // GitHub OAuth token
$server_name = ''; // IP ou domínio válido. Usado no nginx

pattern to replace setInterval with setTimeout

Register a task with setInterval and a interval is not desirable, since the task can take more time than the interval, so the compiler will skip through the current cycle. Replace setInterval with setTimeout with following pattern:

setInterval(function() {
}, interval);


(function loop() {
yushine /
Created Oct 26, 2016 — forked from ksdev-pl/
Polling (setInterval, setTimeout) #js

The setInterval Technique

Now, if you needed to poll your web service, your first instinct might be to do something like this with JavaScript and jQuery:

    $.ajax({ url: "server", success: function(data){
        //Update your dashboard gauge
    }, dataType: "json"});
You can’t perform that action at this time.