/images/profile.png

Python CheatSheet

Where the program starts 1 2 if __name__ == '__main__': # statements Self Use self to pass values between def’s 1 self.arr = nums Array types: List: 1 2 3 4 5 6 7 letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g'] len(letters) # Returns length of array ## Common use list = [] list.append((a,b)) list.sort() # nlogn Tuple: is immutable!

Ruby CheatSheet

Everything in ruby is an object Write/Read file write_handler = File.new("newfile.out", "w") write_handle.puts("sometext").to_s write_handle.close data_from_file = File.read("newfile.out") puts "Data from file: " + data_from_file Comments =begin my comments =end # Comments if-else condition 1 2 3 4 5 6 7 if (xxx) puts... elsif (xxx) puts... else puts... end Comparision puts "5 <=> 10 = " + (5 <=> 10).to_s Loop loop do x += 1 next unless (x%2) == 0 puts x break if x >= 10 end while y <= 10 # until y <= 10 xxx end for num in nums puts "# {num} , " # print - no new line end Array arr = ["a", "b", "c"] arr = Array.

Java CheatSheet

Some Java to know Matrix int m = nums.length; int n = nums[0].length; // Reshape matrix for (int x = 0; x < m * n; ++x) { ans[x / c][x % c] = nums[x / n][x % n]; } Collections Collections.swap(vector, 0, 4); Collections.reverse(row); // row is ArrayList<>() Stack Stack<Integer> s1 = new Stack<Integer>(); Stack<ListNode> stack = new Stack<ListNode>(); stack.pop().val; stack.push(temp); stack.isEmpty(); stack.peek(); stack.size(); Queue Queue<Integer> Q = new LinkedList<Integer>(); Q.

Ultimate guide to build your own blog

Before you start All hugo commands should be run in the root level Build Hugo Blog Locally Step 1: Install hugo && git For Mac user: 1 2 brew install hugo brew install git Step 2: Create a new site 1 2 hugo new site myblog cd myblog Step 3: Add a theme You can find Hugo themes Here In this case I use LoveIt theme as my example