This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta http-equiv="content-type" content="text/html; charset=utf-8" /> | |
| <title></title> | |
| <style type="text/css" media="all"> | |
| </style> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import bluetooth | |
| print "Start discovering...." | |
| nearby_devices = bluetooth.discover_devices() | |
| print "Found devices:" | |
| for bdaddr in nearby_devices: | |
| print bluetooth.lookup_name( bdaddr ), "with address:", bdaddr |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "foo.h" | |
| void | |
| Foo::hello(){ | |
| std::cout << "Hello world" << std::endl; | |
| } | |
| int | |
| Foo::add(int a, int b){ | |
| return a + b; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <iomanip> | |
| #include "binary_search_tree.h" | |
| bool | |
| BinarySearchTree::lookup(node* n, int d) | |
| { | |
| if(!n){ | |
| return false; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <iomanip> | |
| #include "binary_search_tree.h" | |
| bool | |
| BinarySearchTree::lookup(node* n, int d) | |
| { | |
| while(n){ | |
| if(d == n->data){ | |
| return true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "binary_tree.h" | |
| #include <iostream> // std::cout | |
| #include <iomanip> // std::setw | |
| #include <string> // std::string | |
| #include <sstream> // std::istringstream | |
| bool | |
| BinaryTree::ReadNext(std::ifstream& fin, int* data, bool* isNumber) | |
| { | |
| if(!fin.is_open() || !fin.good()){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> // std::cout | |
| #include <iomanip> // std::setw() | |
| #include <vector> // std::vector | |
| std::vector<int> getDescendants(std::vector<std::vector<int>> tree, int node){ | |
| std::vector<int> descendants; | |
| descendants.insert(descendants.end(), tree[node].begin(), tree[node].end()); | |
| for(int i = 0 ; i < descendants.size() ; i++){ | |
| if( descendants[i] < tree.size() && !tree[descendants[i]].empty() ){ | |
| //append |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Copyright 2025 Chun-Min Chang | |
| Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
| The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
| THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| class DictDiffer(object): | |
| """ | |
| Calculate the difference between two dictionaries as: | |
| (1) items intersected | |
| (2) items added | |
| (3) items removed | |
| (4) keys same in both but changed values | |
| (5) keys same in both and unchanged values | |
| """ |
OlderNewer