Skip to content

Instantly share code, notes, and snippets.

Looking for new challenges


Looking for new challenges
View GitHub Profile
kuldipem /
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
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)"
kuldipem /
Created Nov 23, 2017
ubuntu helping cmds cheatsheet
gnome-desktop-item-edit ~/Desktop/ --create-new #create new desktop shortcut
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 / app-exit.js
Created Jul 12, 2016
Cordova/PhoneGap exit app after twice press back button with toast ( plugin required )
View app-exit.js
var lastTimeBackPress=0;
var timePeriodToExit=2000;
function onBackKeyDown(e){
if(new Date().getTime() - lastTimeBackPress < timePeriodToExit){;
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]
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 / iloveyou.c
Created Jul 21, 2015
Want to impress your girlfriend/boyfriend by your coding skill ?
View iloveyou.c
* File: main.c
* Created on 17 July, 2015, 10:17 AM
#include <stdio.h>
#include <stdlib.h>
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 / 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
// 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)) {