Skip to content

Instantly share code, notes, and snippets.

View codeasashu's full-sized avatar
🌊
Waiting to sail

ashutosh chaudhary codeasashu

🌊
Waiting to sail
View GitHub Profile
@codeasashu
codeasashu / SimpleDatabaseHelper.java
Created May 27, 2016 20:16 — forked from mikeplate/SimpleDatabaseHelper.java
Android SQLite very simple database helper example
package se.mobileapplab.datademo;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
/**
* Class that wraps the most common database operations. This example assumes you want a single table and data entity
@codeasashu
codeasashu / test.js
Created June 2, 2016 20:56
NodeJS program to fetch top image text
var cheerio = require('cheerio');
var request = require('request');
var b;
request
({
method: 'GET',
headers: {
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11'
},
url: 'https://www.google.com/searchbyimage?&image_url=http://www.pentel.com/store/media/catalog/product/cache/1/image/9df78eab33525d08d6e5fb8d27136e95/N/X/NXS15-C.png'
@codeasashu
codeasashu / wp-comment-walker
Last active October 20, 2016 22:36 — forked from georgiecel/wp-comment-walker
Custom comment walker for HTML5 friendly WordPress comment and threaded replies. To be inserted in functions.php.
<?php
class comment_walker extends Walker_Comment {
var $tree_type = 'comment';
var $db_fields = array( 'parent' => 'comment_parent', 'id' => 'comment_ID' );
// constructor – wrapper for the comments list
function __construct() { ?>
<section class="comments-list">
@codeasashu
codeasashu / install_wp.sh
Created September 28, 2016 06:36
Collection of useful ubuntu bash scripts
#!/bin/bash
# Bash script to install latest wordpress from repo
#Uses wget
#Download latest wordpress
wget -O latest.tar.gz "https://wordpress.org/latest.tar.gz"
#Extract contents
tar xvzf latest.tar.gz
@codeasashu
codeasashu / install_ftp.sh
Last active February 11, 2017 05:51
Lamp installation instructions on amazon ami
#!/bin/bash
## You may also want to add new users and give only FTP access
## Lets start by installing popular FTP server: vsftp
sudo yum install vsftpd
## We will be modify vsftpd configurations, hence lets act smart and take a backup
sudo cp /etc/vsftpd.conf /etc/vsftpd.conf.backup
## You will need public IP address of your instance. Note it down by going to console
@codeasashu
codeasashu / installvimrc.sh
Last active November 15, 2016 12:38
Install my own vim configuration
DIRECTORY='.vim_runtime'
cd ~
if [ -d "$DIRECTORY" ]; then
echo "Deleting old vim runtime configurations..."
rm -rf "$DIRECTORY"
fi
echo "Done"
echo "Getting latest configs..."
git clone https://github.com/ashutosh2k12/vimrc.git ~/.vim_runtime && sh ~/.vim_runtime/install_awesome_vimrc.sh
@codeasashu
codeasashu / checklist_debug.php
Created November 17, 2016 19:11
PHP debug checklist
<?php
/**
* File to remind myself what things may come handy
* while I get stuck somewhere and don't have idea
* why things aren't working. These tricks may help you
* know the cause and solve the issue
**/
//Checklist 1: Sometimes, your json_encode may return null or false.
//So to know if there is some issue in json_encode itself, use this switch below
@codeasashu
codeasashu / git_strategy.md
Last active December 16, 2016 22:47
A quick nice strategy for git to maintain small team and set of 2-3 developers working on single project

##TL;DR

git push origin master:refs/heads/development
git checkout --track origin/development

git pull
git checkout -b my_cool_feature
git add .
git commit -m "Commit message"
@codeasashu
codeasashu / player.sh
Created January 6, 2017 10:34
Play multiple file extensions in ubuntu repeatedly
#Current Dir .
find . -maxdepth 1 \( -name "*.m4a" -or -name "*.webm" -or -name "*.mp3" -or -name "*.mp4" \) -exec mplayer -loop 0 -novideo {} +

Use rsync to sync your project to server. Use syncd to automate it.

attaching installation process

  1. Install rsync
  2. Get syncd from https://github.com/codeasashu/syncd.git (branch: direction)
  3. copy syncd and watch.sh to /usr/local/bin so you can execute it directly in terminal cp syncd /usr/local/bin cp watch.sh /usr/local/bin