Skip to content

Instantly share code, notes, and snippets.

View srli's full-sized avatar

Sophia Li srli

View GitHub Profile
#!/usr/bin/python
"""
This code is part of ros package that subscribes to an image topic
and detects smiles found in the image. Results are then republished to a ros
image topic.
This node is an example of how I prefer to write my ROS nodes, as a single
class with a run function.
@srli
srli / astar_pseudo.py
Created March 9, 2018 05:20
Pseudo code for an A* path solver
#!/usr/bin/python
import heapq
class Cell(object):
def __init__(self, x, y, is_wall):
self.reachable = not is_wall
self.x = x
self.y = y
self.parent = None
@srli
srli / astar_destruct_pseudo.py
Created March 9, 2018 05:30
A* with path destruction
def solve(self):
# Add starting cell to open heap queue
heapq.heappush(self.opened, (self.start.f, self.start))
while len(self.opened):
# Pop cell from heap queue
f, cell = heapq.heappop(self.opened)
# Add cell to closed list so we don't process it twice
self.closed.add(cell)
@srli
srli / stt_py3.py
Created June 25, 2018 14:47
Speech to text with PocketSphinx for Python3
from pocketsphinx.pocketsphinx import *
from sphinxbase.sphinxbase import *
import os
import pyaudio
import wave
import audioop
from collections import deque
import time
import math
@srli
srli / caesar_cipher.py
Created June 26, 2018 03:35
Sample encoding and decoding caesar cipher generator
import string
import random
from collections import Counter
"""
An easy implementation of the Caesar cipher
Written by Sophie Li, 2018
http://blog.justsophie.com/caesar-cipher-generator/
"""
@srli
srli / CMakeLists.txt
Created October 17, 2019 01:24
Modified CMakeLists.txt for v1.91 h-encore build
cmake_minimum_required(VERSION 3.9)
find_package(Threads)
find_package(LibXml2 REQUIRED)
if (MINGW)
add_definitions(-mno-ms-bitfields)
endif ()
if (MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -D_WINSOCK_DEPRECATED_NO_WARNINGS)