Skip to content

Instantly share code, notes, and snippets.

View abdulhalim-cu's full-sized avatar

Abdul Halim abdulhalim-cu

  • Brain Station 23 Ltd
  • Dhaka
View GitHub Profile
@abdulhalim-cu
abdulhalim-cu / reverse.js
Created November 4, 2017 12:39
Arrays have a method reverse, which changes the array by inverting the order in which its elements appear. For this exercise, write two functions, reverseArray and reverseArrayInPlace. The first, reverseArray, takes an array as argument and produces a new array that has the same elements in the inverse order. The second, reverseArrayInPlace, doe…
// Your code here.
function reverseArray(array){
var arr_list = [];
for (var i = array.length - 1; i >= 0; i--) {
arr_list.push(array[i]);
}
return arr_list;
}
function reverseArrayInPlace(array) {
@abdulhalim-cu
abdulhalim-cu / odoo_uninstall_process.txt
Created October 29, 2017 05:58
How to remove Odoo from Ubuntu
* Stop Server
* Remove all odoo files
* Remove postgresql from system
STOP SERVER
sudo service odoo stop
or sudo service odoo-server stop (if odoo-server instead of odoo)
REMOVE ALL ODOO FILES
sudo rm -R /opt/odoo
REMOVE CONFIG FILES
@abdulhalim-cu
abdulhalim-cu / count_char.js
Created October 25, 2017 12:34
You can get the Nth character, or letter, from a string by writing "string".charAt(N), similar to how you get its length with "s".length. The returned value will be a string containing only one character (for example, "b"). The first character has position zero, which causes the last one to be found at position string.length - 1. In other words,…
// Your code here.
function countBs(string){
number_of_bs = 0;
for (count = 0; count < string.length; count++){
if (string[count] == "B")
number_of_bs += 1;
}
return number_of_bs;
}
@abdulhalim-cu
abdulhalim-cu / isEven.js
Created October 25, 2017 12:22
We’ve seen that % (the remainder operator) can be used to test whether a number is even or odd by using % 2 to check whether it’s divisible by two. Here’s another way to define whether a positive whole number is even or odd
// Your code here.
function isEven(number){
while (number > 0 || number < 0)
if (number > 0 && (isEven(number - 1) == 0))
return true;
else if(number < 0 && (isEven(number + 1) == 0))
return true;
else
return false;
}
function findSolution(target) {
function find(current, history){
if (current == target)
return history;
else if (current > target)
return null;
else
return find(current + 5, "(" + history + " + 5)") ||
find(current * 3, "(" + history + " * 3)");
}
function power(base, exponent){
if (exponent == 0)
return 1;
else
return base * power(base, exponent-1);
}
console.log(power(5, 6));
@abdulhalim-cu
abdulhalim-cu / mountain.js
Last active October 25, 2017 08:19
Mountain view using javascript
var landscape = function() {
var result = "";
var flat = function(size){
for (i=0; i<size; i++)
result += "_";
}
var mountain = function(size){
result += "/"
for (i=0; i<size; i++)
result += "'";
# Add CodeLite Public Key
sudo apt-key adv --fetch-keys http://repos.codelite.org/CodeLite.asc
# Add repository to /etc/apt/sources.list
deb http://repos.codelite.org/wx3.1.0/ubuntu/ xenial universe
# Update system
sudo apt-get update
# Install packages
@abdulhalim-cu
abdulhalim-cu / Odoo-10-Install-Process
Created October 15, 2017 09:36
Install Odoo 10 on Ubuntu 16.04 LTS
Setp-1: Update & Upgrade Source List
update apt source list
sudo apt-get upgrade
Step-2: Install python dependencies for Odoo
sudo apt-get install python-dateutil python-docutils python-feedparser python-jinja2 python-ldap python-libxslt1 python-lxml python-mako python-mock python-openid python-psycopg2 python-psutil python-pybabel python-pychart python-pydot python-pyparsing python-reportlab python-simplejson python-tz python-unittest2 python-vatnumber python-vobject python-webdav python-werkzeug python-xlwt python-yaml python-zsi poppler-utils python-pip python-pypdf python-passlib python-decorator gcc python-dev mc bzr python-setuptools python-markupsafe python-reportlab-accel python-zsi python-yaml python-argparse python-openssl python-egenix-mxdatetime python-usb python-serial lptools make python-pydot python-psutil python-paramiko poppler-utils python-pdftools antiword python-requests python-xlsxwriter python-suds python-psycogreen python-ofxparse python-gevent
Step-3: Odoo Web dependencies
@abdulhalim-cu
abdulhalim-cu / sublime-text-3-for-ubuntu-16.04-or-higher
Created October 15, 2017 09:16
Install Sublime Text 3 in Ubuntu 16.04 & Higher The Official Way
1. Open terminal via Ctrl+Alt+T & run command to install the Key:
wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -
2. Then add the apt repository via command:
echo "deb https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list
3. Finally check updates and install sublime-text by running commands on terminal
sudo apt update && sudo apt install -y sublime-text
Uninstall Sublime Text: