Skip to content

Instantly share code, notes, and snippets.

@AdoHaha
AdoHaha / gist:3829069
Created October 3, 2012 19:05
Dodawanie RSS do Google Readera
javascript:var b=document.body;var GR________bookmarklet_domain='http://www.google.pl';if(b&&!document.xmlVersion){void(z=document.createElement('script'));void(z.src='http://www.google.pl/reader/ui/subscribe-bookmarklet.js');void(b.appendChild(z));}else{location='http://www.google.com/reader/view/feed/'+encodeURIComponent(location.href)}
''' gist below can accept a csv list with unicode coding, for example list of names from around the world as in example'''
import csv,codecs,cStringIO
import jinja2
''' copied from StackExchange'''
class UTF8Recoder:
def __init__(self, f, encoding):
self.reader = codecs.getreader(encoding)(f)
def __iter__(self):
return self
def next(self):
@AdoHaha
AdoHaha / test_throttle.py
Last active May 7, 2016 06:17
A throttle function decorator in Python similar to the one in underscore.js, inspired by debounce decorator from: https://gist.github.com/walkermatt/2871026
#!/usr/bin/python
import unittest
import time
from throttle import throttle
class TestThrottle(unittest.TestCase):
@throttle(1)
def increment(self):
import re
import sys
filename = sys.argv[-1]
gcode = open(filename)
data = gcode.read()
def replace(match):
match = match.group(2)
#print match
serious_zaok=str(round(float("0."+match),5))
@AdoHaha
AdoHaha / change_hostname.desktop
Last active August 16, 2017 21:52
change hostname through Tkinter app
[Desktop Entry]
Type=Application
Exec=python /home/robotuser/helper/change_hostname.py
Icon=/home/robotuser/Downloads/change.png # only if needed
Name=Change the hostname
Terminal=false
@AdoHaha
AdoHaha / bma220.py
Created October 15, 2021 14:54
Read bma220 accelerometer micropython esp32
import machine
i2c = machine.I2C(0)
import struct
import time
import math
def calib_g(val):
return val*0.613305+0.0124529
while True:
class Shifting:
"""minimalistic shifting register"""
point = 0
def __init__(self,el,how_m):
"""el -- first element to add
how_m -- length of shifting register
"""
self.lis = [el for ii in range(how_m)] # we start with multiplying first element
self.how_m = how_m
@AdoHaha
AdoHaha / usluga_ros2.py
Last active March 31, 2023 16:19
przyklad_ czyszczenie
### podstawowe przyklady do rozwiniecia
from rclpy.node import Node
from geometry_msgs.msg import Twist
from turtlesim.msg import Pose
'''searching for keywords based on chat gpt json user archive'''
import json
# Load the json file
with open('conversations.json') as json_file:
whole_string = json_file.read()
chats = json.loads(whole_string)
@AdoHaha
AdoHaha / config.yaml
Last active April 27, 2023 15:03
working config for root 3 controller fluid nc, 6040 now forever
board: Root Controller ISO
name: Root 3 V20
stepping:
engine: I2S_STREAM
idle_ms: 255
pulse_us: 10
dir_delay_us: 2
disable_delay_us: 3
axes: