Skip to content

Instantly share code, notes, and snippets.

View khssnv's full-sized avatar

Alisher A. Khassanov khssnv

View GitHub Profile
@wassname
wassname / to_filename.py
Last active November 30, 2022 14:19
python convert string to safe filename
"""
Url: https://gist.github.com/wassname/1393c4a57cfcbf03641dbc31886123b8
"""
import unicodedata
import string
valid_filename_chars = "-_.() %s%s" % (string.ascii_letters, string.digits)
char_limit = 255
def clean_filename(filename, whitelist=valid_filename_chars, replace=' '):
@galou
galou / .ycm_extra_conf.py
Last active April 4, 2022 10:18
YouCompleteMe configuration file for ROS, copy to $ROS_WORKSPACE
# -*- coding: utf-8 -*-
##########################################################################
# YouCompleteMe configuration for ROS #
# Author: Gaël Ecorchard (2015) #
# #
# The file requires the definition of the $ROS_WORKSPACE variable in #
# your shell. #
# Name this file .ycm_extra_conf.py and place it in $ROS_WORKSPACE to #
# use it. #
/**
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
@nzjrs
nzjrs / rospy_logging.py
Created January 30, 2014 16:06
Reconnect python logging calls with the ROS logging system
class ConnectPythonLoggingToROS(logging.Handler):
MAP = {
logging.DEBUG:rospy.logdebug,
logging.INFO:rospy.loginfo,
logging.WARNING:rospy.logwarn,
logging.ERROR:rospy.logerr,
logging.CRITICAL:rospy.logfatal
}
0 = Success
1 = Operation not permitted
2 = No such file or directory
3 = No such process
4 = Interrupted system call
5 = Input/output error
6 = No such device or address
7 = Argument list too long
8 = Exec format error

Introduction

  • C-a == Ctrl-a
  • M-a == Alt-a

General

:q        close
:w        write/saves
:wa[!]    write/save all windows [force]
:wq       write/save and close
@jboner
jboner / latency.txt
Last active May 11, 2024 04:16
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD