Instantly share code, notes, and snippets.

🎯
Focusing

# He, Peng codyhex

🎯
Focusing
Created February 16, 2020 22:24
This file contains 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
Created January 27, 2020 04:25
This file contains 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
 class Solution: def spiral_print(self, matrix): seen = set() action_seq = [(0, +1), (+1, 0), (0, -1), (-1, 0)] act = 0 curr = (0, 0) seen.add(curr) res = [] res.append(matrix[curr[0]][curr[1]])
Last active July 27, 2019 21:17
This file contains 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
 def get_neighbors_4C(self, pt): # put self.gird in your class private x,y = pt[0], pt[1] # x positive top down, Y to the right maxX = len(self.grid) maxY = len(self.grid[0]) # define the neighbor pattern nc4 = '[[x-1,y], [x+1,y], [x,y-1], [x,y+1]]'
Created February 5, 2019 22:34
This file contains 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/env python import rospy import tf from tf import transformations as ts from geometry_msgs.msg import Transform, Vector3, Quaternion from geometry_msgs.msg import TransformStamped from std_msgs.msg import Header
Created February 5, 2019 22:34
This file contains 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 #include #include #include #include int main(int argc, char** argv){ ros::init(argc, argv, "fix_tf_cpp"); ros::NodeHandle node;
Created December 12, 2018 15:08
use this @name so the IDE (Jetbrains) can integrate it.
This file contains 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
 /** * @brief Constructor for the wrapper * @param name The name for this costmap * @param tf A reference to a TransformListener */
Created November 20, 2017 23:18
This file contains 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 struct A { int data[2]; A(int x, int y) : data{x, y} {} virtual void f() {} };
Created November 20, 2017 17:51
checkBaseClass created by Hexe - https://repl.it/@Hexe/checkBaseClass
This file contains 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 /* * Class template identification */ using namespace std; template class IsDerivedFromHelper {
Created November 18, 2017 21:56
makeCombinations created by Hexe - https://repl.it/@Hexe/makeCombinations
This file contains 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 #include using namespace std; /***********************************************/ /* @Task: combination * @Input: n: number range 1 to n; k is number takes * @Return: list of lists * @Example: leetcode 8.5
Created November 15, 2017 17:18
isValidBST created by Hexe - https://repl.it/@Hexe/isValidBST
This file contains 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 #include struct TreeNode { int val; TreeNode* left; TreeNode* right; TreeNode(int x): val(x), left(nullptr), right(nullptr) {} };