Skip to content

Instantly share code, notes, and snippets.

View imasif's full-sized avatar
🏠
Working from home

Md. Asif Khan imasif

🏠
Working from home
View GitHub Profile
@imasif
imasif / exportDB.sh
Last active June 22, 2020 13:57
Export mongodb database into JSON files, and import the JSON again.
#!/bin/bash
if [ ! $1 ]; then
echo " Example of use: $0 database_name dir_to_store"
exit 1
fi
db=$1
out_dir=$2
if [ ! $out_dir ]; then
out_dir="./"
@zubaer-ahammed
zubaer-ahammed / Reset MySQL Root Password in Mac OS.md
Last active April 4, 2024 10:38
Reset MySQL Root Password in Mac OS

Reset mysql root password in Mac OS:

First Stop MySQL:

  1. Go to: 'System Preferences' >> 'MySQL' and stop MySQL

OR,

  1. sudo /usr/local/mysql/support-files/mysql.server start
  2. sudo /usr/local/mysql/support-files/mysql.server stop
@wenzhixin
wenzhixin / ubuntu14.04-command-line-install-android-sdk
Last active January 16, 2024 21:15
Ubuntu 14.04 command line install android sdk
# install openjdk
sudo apt-get install openjdk-7-jdk
# download android sdk
wget http://dl.google.com/android/android-sdk_r24.2-linux.tgz
tar -xvf android-sdk_r24.2-linux.tgz
cd android-sdk-linux/tools
# install all sdk packages
@eristoddle
eristoddle / fix_udev.sh
Created July 10, 2014 02:30
Fix for node-webkit on Ubuntu 14.04 error while loading shared libraries: libudev.so.0
sudo ln -sf /lib/x86_64-linux-gnu/libudev.so.1 /lib/x86_64-linux-gnu/libudev.so.0
@albabar
albabar / unique_array.php
Created March 1, 2014 13:29
Remove duplicate arrays from a 2D array. Takes an input 2D array and returns a new 2D array without duplicate arrays.
<?php
function unique_array($multidimetionalarray) {
$static_array = array();
foreach($multidimetionalarray as $array){
$static_array[] = json_encode($array);
}
$filtered_static_array = array_unique($static_array);
$filtered_array = array();
foreach($filtered_static_array as $array){
$filtered_array[] = json_decode($array, true);
@msurguy
msurguy / upload.php
Last active August 29, 2015 13:56
using jquery fileAPI plugin (https://github.com/RubaXa/jquery.fileapi/) with Intervention Image class (intervention.olivervogel.net) to upload and resize images
ini_set("memory_limit","200M");
if( !empty($_SERVER['HTTP_ORIGIN']) ){
// Enable CORS
header('Access-Control-Allow-Origin: ' . $_SERVER['HTTP_ORIGIN']);
header('Access-Control-Allow-Methods: POST, GET, OPTIONS');
header('Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Range, Content-Disposition, Content-Type');
}
if( $_SERVER['REQUEST_METHOD'] == 'OPTIONS' ){
@tsabat
tsabat / zsh.md
Last active December 25, 2023 19:16
Getting oh-my-zsh to work in Ubuntu
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active March 8, 2024 02:11
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh