Skip to content

Instantly share code, notes, and snippets.

View kuldipem's full-sized avatar
:shipit:
Looking for new challenges

KULDIP PIPALIYA kuldipem

:shipit:
Looking for new challenges
View GitHub Profile
@kuldipem
kuldipem / start.sh
Last active June 13, 2020 10:00
Ubuntu/Linux shell script to run using cron to confirm services status, if not running then send email and start the service
#!/bin/sh
APACHE2_STATUS="$(systemctl is-active apache2.service)"
MYSQL_STATUS="$(systemctl is-active mysql.service)"
NGINX_STATUS="$(systemctl is-active nginx.service)"
DOVECOT_STATUS="$(systemctl is-active dovecot.service)"
START_SCRIPT_DEBUG="true"
FLAG_STATUS="active"
SendEmail(){
@kuldipem
kuldipem / ubuntu.sh
Created November 23, 2017 14:47
ubuntu helping cmds cheatsheet
gnome-desktop-item-edit ~/Desktop/ --create-new #create new desktop shortcut
@mcnamee
mcnamee / bitbucket-pipelines.yml
Last active December 14, 2023 03:57
Bitbucket Pipelines - Deploy via FTP to shared hosting
# Installation ---
# 1. In Bitbucket, add FTP_USERNAME, FTP_PASSWORD and FTP_HOST as environment variables.
# 2. Commit this file (bitbucket-pipelines.yml) to your repo (in the repo root dir)
# 3. From Bitbucket Cloud > Commits > Commit Number > Run Pipeline > Custom:Init (this will
# push everything and initialize GitFTP)
#
# Usage ---
# - On each commit to master branch, it'll push all files to the $FTP_HOST
# - You also have the option to 'init' (see 'Installation' above) - pushes everything and initialises
# - Finally you can also 'deploy-all' (from Bitbucket Cloud > Commits > Commit Number > Run Pipeline > Custom:deploy-all)
@kuldipem
kuldipem / app-exit.js
Created July 12, 2016 19:36
Cordova/PhoneGap exit app after twice press back button with toast ( plugin required https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin )
var lastTimeBackPress=0;
var timePeriodToExit=2000;
function onBackKeyDown(e){
e.preventDefault();
e.stopPropagation();
if(new Date().getTime() - lastTimeBackPress < timePeriodToExit){
navigator.app.exitApp();
}else{
window.plugins.toast.showWithOptions(
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule>
@remojansen
remojansen / class_decorator.ts
Last active September 14, 2023 14:54
TypeScript Decorators Examples
function logClass(target: any) {
// save a reference to the original constructor
var original = target;
// a utility function to generate instances of a class
function construct(constructor, args) {
var c : any = function () {
return constructor.apply(this, args);
}
@kuldipem
kuldipem / iloveyou.c
Created July 21, 2015 14:44
Want to impress your girlfriend/boyfriend by your coding skill ?
/*
* File: main.c
* Author: KULDIP PIPALIYA <kuldipem@gmail.com>
*
* Created on 17 July, 2015, 10:17 AM
*/
#include <stdio.h>
#include <stdlib.h>
find . -type f -iname '*.pdf'
@paulallies
paulallies / gist:0052fab554b14bbfa3ef
Last active November 12, 2023 23:00
Remove node_modules from git repo
#add 'node_modules' to .gitignore file
git rm -r --cached node_modules
git commit -m 'Remove the now ignored directory node_modules'
git push origin <branch-name>
@combatpoodle
combatpoodle / beautifier.php
Last active August 29, 2015 14:02
Quick hack to doctor phpdoc tags. I recommend turning off your default Beautifier settings as well, as they mess with whitespace. You'll want to tweak the indentation and styling in order to use this effectively; I followed up with simple regex batches when using this in order to conform to CakePHP's sniffer standard. Based on solution at http:/…
<?php
// This is intended to govern fixing of stuff and clean up some weird whitespace stuff. Regexes are obviously not the best way to do that (especially given we're interfacing with beautifier...), but works OK for a quick-and-dirty solution.
// I also did a quick-and-dirty modification to the Beautifier's default whitespace filter to prevent it from executing.
require_once 'PHP/Beautifier.php';
$fileName = $argv[1];
if (!file_exists($fileName)) {