Skip to content

Instantly share code, notes, and snippets.

Avatar
:shipit:
Looking for new challenges

KULDIP PIPALIYA kuldipem

:shipit:
Looking for new challenges
View GitHub Profile
@kuldipem
kuldipem / start.sh
Last active Jun 13, 2020
Ubuntu/Linux shell script to run using cron to confirm services status, if not running then send email and start the service
View start.sh
#!/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 Nov 23, 2017
ubuntu helping cmds cheatsheet
View ubuntu.sh
gnome-desktop-item-edit ~/Desktop/ --create-new #create new desktop shortcut
@mcnamee
mcnamee / bitbucket-pipelines.yml
Last active Oct 31, 2021
Bitbucket Pipelines - Deploy via FTP to shared hosting
View bitbucket-pipelines.yml
# 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 Jul 12, 2016
Cordova/PhoneGap exit app after twice press back button with toast ( plugin required https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin )
View app-exit.js
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(
View .htaccess
<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 Dec 1, 2021
TypeScript Decorators Examples
View class_decorator.ts
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 Jul 21, 2015
Want to impress your girlfriend/boyfriend by your coding skill ?
View iloveyou.c
/*
* File: main.c
* Author: KULDIP PIPALIYA <kuldipem@gmail.com>
*
* Created on 17 July, 2015, 10:17 AM
*/
#include <stdio.h>
#include <stdlib.h>
@paulallies
paulallies / gist:0052fab554b14bbfa3ef
Last active Jan 22, 2022
Remove node_modules from git repo
View gist:0052fab554b14bbfa3ef
#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>
@israelshirk
israelshirk / beautifier.php
Last active Aug 29, 2015
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:/…
View beautifier.php
<?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)) {