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 / 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 / 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 / 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 / arraytolist_and_listtoarray.js
Created November 4, 2017 13:45
Write a function arrayToList that builds up a data structure like the previous one when given [1, 2, 3] as argument, and write a listToArray function that produces an array from a list. Also write the helper functions prepend, which takes an element and a list and creates a new list that adds the element to the front of the input list, and nth, …
function arrayToList(array) {
var list=null;
for (var i=array.length - 1; i >= 0; i--) {
list = {value:array[i], rest:list};
}
return list;
}
function listToArray(list){
var array = [];
# Script that installs additional command-line interface (CLI) software for Ubuntu/Debian
# Keep Ubuntu or Debian up to date
sudo apt-get -y update
sudo apt-get -y upgrade
sudo apt-get -y dist-upgrade
sudo apt-get -y autoremove
# Development tools:
sudo apt-get install -y build-essential cmake
# Script that installs additional graphical user interface (GUI) software for Ubuntu/Debian
# Keep Ubuntu or Debian up to date
sudo apt-get -y update
sudo apt-get -y upgrade
sudo apt-get -y dist-upgrade
sudo apt-get -y autoremove
# Development tools:
sudo apt-get install -y gdebi
####################################
# SET UP NUMIX ON DEBIAN WITH XFCE #
####################################
# | THIS SCRIPT IS TESTED CORRECTLY ON |
# |------------------------------------|
# | OS | Test | Last test |
# |----------------|------|------------|
# | Debian 9.1 | OK | 4 Sep 2017 |
function deepEqual(a, b) {
if (a === b) return true;
if (a == null || typeof a != "object" ||
b == null || typeof b != "object")
return false;
var propsInA = 0, propsInB = 0;
for (var prop in a)
@abdulhalim-cu
abdulhalim-cu / filter-array.js
Last active November 10, 2017 09:36
To find the people in the ancestry data set who were young in 1924, the following function might be helpful. It filters out the elements in an array that don’t pass a test.
// ancestry = http://eloquentjavascript.net/code/ancestry.js
function filter(array, test) {
var passed = [];
for (var i = 0; i < array.length; i++) {
if (test(array[i]))
passed.push(array[i]);
}
return passed;
}
import os
for folderName, subfolders, filenames in os.walk('C:\\delicious'):
print('The current folder is ' + folderName)
for subfolder in subfolders:
print('SUBFOLDER OF ' + folderName + ': ' + subfolder)
for filename in filenames:
print('FILE INSIDE ' + folderName + ': '+ filename)