Skip to content

Instantly share code, notes, and snippets.

@wowkin2
wowkin2 / gazebo.py
Created February 26, 2024 14:19
Reset Gazebo world to restore initial position
import rospy
from std_srvs.srv import Empty
def reset_world():
"""
Reset Gazebo world to restore initial position
"""
rospy.wait_for_service('/gazebo/reset_world')
@wowkin2
wowkin2 / script.js
Created December 8, 2020 14:32
Highlight Python test coverage with color (for percent row)
$('.right').each(function(a, b){
var value = $(this).html();
if (value !== undefined) {
var red = 255 - parseInt(value.slice(0, -1)) * 2;
var green = 0 + parseInt(value.slice(0, -1)) * 2;
var color = 'rgb(' + red + ', ' + green + ', 0)';
$(this).css('background', color);
console.log(value, color);
@wowkin2
wowkin2 / convert_crlf_to_lf.py
Last active November 20, 2020 09:14
Convert line ending from Windows CRLF to Unix LF (Ubuntu, Linux)
import os
CRLF = b'\r\n'
LF = b'\n'
allowed_extensions = [
'gitignore', 'Procfile', 'Docker',
'txt', 'md', 'ini', 'json', 'yaml', # NOTE: do not add csv, they can be huge
'js', 'css', 'scss', 'html', 'htm', 'svg',
@wowkin2
wowkin2 / aiosmtpd.py
Created May 21, 2020 13:01 — forked from cnicodeme/aiosmtpd.py
ImprovMX handler
import ssl
import socket
import asyncio
import logging
import collections
import time
from asyncio import sslproto
from email._header_value_parser import get_addr_spec, get_angle_addr
from email.errors import HeaderParseError
@wowkin2
wowkin2 / data_parser.js
Last active February 6, 2020 22:08
Scripts for download photos from imageshack.com with original names
/**
Following script will parse all photos on imageshack.com
and will prepare list of files with appropriate names (like it they were originally)
to be downloaded on the next step
Scroll till the end of the page, so all images will be lazy-loaded.
Press F12 in browser copy-paste following code and press Enter.
Copy result and add it to the following Python script.
**/
var data = [];
@wowkin2
wowkin2 / url_parser.py
Last active March 4, 2019 14:41
Python parser of all non-commented links from html document.
import re
content = '''
<img src="/images/lol/hallo.png" />
/images/lol/hallo.png
/images/lol/hallo.png
//example.com/images/lol/hallo.png
http://example.com/images/lol/hallo.png
https://example.com/images/lol/hallo.png
<!-- /images/lol/commented.png -->
@wowkin2
wowkin2 / haveibeenpwned_password.py
Created January 22, 2019 22:24
API to check password on HaveIBeenPwned service
import hashlib
import requests
import getpass
def test_pw(byte_string):
hasher = hashlib.sha1()
hasher.update(byte_string)
digest = hasher.hexdigest().upper()
print(f'Hash: {digest[:5]}, {digest[5:]}')
print(f'GET https://api.pwnedpasswords.com/range/{digest[:5]}')
@wowkin2
wowkin2 / async_tcp_scan.py
Created December 26, 2018 08:48 — forked from 0xpizza/async_tcp_scan.py
TCP Network scanner using asyncio for Python 3.7
#!/usr/bin/python3.7
import asyncio
import ipaddress
import re
import sys
MAX_NUMBER_WORKERS = 200
@wowkin2
wowkin2 / dijkstra.py
Created October 7, 2018 20:41 — forked from mdsrosa/dijkstra.py
Modified Python implementation of Dijkstra's Algorithm (https://gist.github.com/econchick/4666413)
from collections import defaultdict, deque
class Graph(object):
def __init__(self):
self.nodes = set()
self.edges = defaultdict(list)
self.distances = {}
def add_node(self, value):
@wowkin2
wowkin2 / Readme.md
Last active March 22, 2024 02:22
Solution: "Exceeded 4 calls per second for api client" Python Shopify API - shopify_python_api

Solution for API call limit "shopify_python_api"

If you are using Python Shopify API and getting following error
"Exceeded 4 calls per second for api client. Reduce request rates to resume uninterrupted service."
but want your script to continue working with some timeout after that,
you can use following script from shopify_limits_patch.py.

For that just copy shopify_limits_patch.py to your project and import shopify_limits_patch.

Or if you want to call it implicitly import it, remove last line patch_shopify_with_limits()
and call it before all your shopify calls.