Skip to content

Instantly share code, notes, and snippets.

@vikasprogrammer
vikasprogrammer / monitor.php
Created December 24, 2021 09:43
Monitor a file for changes and notifies via slack when its changed.
<?php
$changed = false;
$hash = "5718fb07bde7a1c585c533d1b720cf8b";
$filename = "index.php";
while(true) {
$current_hash = md5(file_get_contents($filename));
if($current_hash != $hash) {
if($changed == false) {
@vikasprogrammer
vikasprogrammer / gist:092ef68ce092cfa664f183a73a5dcb2a
Created July 3, 2021 11:17
Too many open files : Nginx (log)
ERROR:
++++++
2021/07/03 08:20:10 [alert] 8744#8744: setrlimit(RLIMIT_NOFILE, 2165535) failed (1: Operation not permitted)
2021/07/03 08:20:10 [alert] 8743#8743: setrlimit(RLIMIT_NOFILE, 2165535) failed (1: Operation not permitted)
2021/07/03 08:20:22 [alert] 8814#8814: setrlimit(RLIMIT_NOFILE, 2165535) failed (1: Operation not permitted)
2021/07/03 08:20:22 [alert] 8815#8815: setrlimit(RLIMIT_NOFILE, 2165535) failed (1: Operation not permitted)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Workaround:
@vikasprogrammer
vikasprogrammer / stripe-copy-subscriptions.php
Last active February 7, 2020 12:21
Copy stripe subscriptions after migration
<?php
/*
Author: Vikas Singhal (@vikasprogrammer)
Pre-reqs:
Create plans on target account with same plan id.
Description:
It simply copies over the old subscription in source account to new account mapping the customer and plans. It spits out the new sub_id which you can copy to EDD or whatever billing system you are using.
It can also cancel plans in the old account.
/*
@vikasprogrammer
vikasprogrammer / RetryCCXT.php
Last active July 23, 2019 07:46
Retry Requests CCXT (PHP)
class RetryCCXT {
public $ex;
public function __construct($ex) {
$this->ex = $ex;
}
public function __call($function, $params) {
try {
return call_user_func_array([$this->ex, "$function"], $params);
@vikasprogrammer
vikasprogrammer / wp.sh
Last active February 6, 2017 12:18 — forked from phlbnks/wp.sh
#!/bin/bash -e
clear
echo "============================================"
echo "WordPress Install Script"
echo "============================================"
echo "Do you need to setup new MySQL database? (y/n)"
setupmysql=$1
if [ "$setupmysql" == y ] ; then
echo "MySQL Admin User: "
mysqluser=$2
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-scroll-header-panel/core-scroll-header-panel.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
<link rel="import" href="../chart-js/chart-js.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;
<link rel="import" href="../../salesforce/mobile-ui-elements/elements/force-ui-app/force-ui-app.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-field/core-field.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../core-input/core-input.html">
<link rel="import" href="../core-icons/core-icons.html">