Skip to content

Instantly share code, notes, and snippets.

View vane's full-sized avatar
🏴‍☠️
Arrr

Michal Szczepanski vane

🏴‍☠️
Arrr
View GitHub Profile
@vane
vane / cgi.lua
Last active November 7, 2023 22:47
openresty call script read stdout and return as response
-- test.py - set absolute path
-- functions
local function write_error(data)
ngx.status = 500
ngx.say('<h1>CGI response error</h1>')
ngx.say(data)
ngx.exit(ngx.OK)
end
@vane
vane / selenium-scrap.py
Created November 5, 2023 03:57
python save page mhtml and screenshot using selenium webdriver
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import base64
import os.path
import selenium.webdriver.chrome.webdriver
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
@vane
vane / jira-plugin-development.txt
Last active November 7, 2023 22:50
jira plugin development
https://atlaskit.atlassian.com
JIRA API TOKEN with email https://id.atlassian.com/manage-profile/security/api-tokens
docker volume create --name jiraVolume
docker run -v jiraVolume:/var/atlassian/application-data/jira --name="jira" -d -p 8090:8090 -e ATL_TOMCAT_PORT=8090 atlassian/jira-software
http://localhost:8090/plugins/servlet/restbrowser#/resource/api-2-project
https://developer.atlassian.com/cloud/jira/software/build-a-jira-app-using-a-framework/
// XPath CheatSheet
// To test XPath in your Chrome Debugger: $x('/html/body')
// http://www.jittuu.com/2012/2/14/Testing-XPath-In-Chrome/
// 0. XPath Examples.
// More: http://xpath.alephzarro.com/content/cheatsheet.html
'//hr[@class="edge" and position()=1]' // every first hr of 'edge' class
Android Emulator usage: emulator [options] [-qemu args]
options:
-sysdir <dir> search for system disk images in <dir>
-system <file> read initial system image from <file>
-datadir <dir> write user data into <dir>
-kernel <file> use specific emulated kernel
-ramdisk <file> ramdisk image (default <system>/ramdisk.img
-image <file> obsolete, use -system <file> instead
-initdata <file> same as '-init-data <file>'
-data <file> data image (default <datadir>/userdata-qemu.img
@vane
vane / server.py
Created October 8, 2020 00:09
aiohttp register routes from file with prefix to the application
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
from aiohttp import web, hdrs
import test_api
__version__ = '0.1'
def register_routes(router: web.UrlDispatcher, routes: web.RouteTableDef, prefix: str = ''):
for route in routes: # type: web.RouteDef

Keybase proof

I hereby claim:

  • I am vane on github.
  • I am szczepano (https://keybase.io/szczepano) on keybase.
  • I have a public key whose fingerprint is DFB4 20E8 41B0 0521 5DCE 5AC4 3DCE FDDF CCB1 DC69

To claim this, I am signing this object:

@vane
vane / Dockerfile
Created October 23, 2018 16:02
Dockerfile alpine linux pysvn
FROM python:2.7-alpine
RUN apk add --no-cache subversion
RUN apk add --no-cache subversion-dev
RUN apk add --no-cache py-subversion
RUN apk add --no-cache apr-util-dev
RUN wget http://tigris.org/files/documents/1233/49465/pysvn-1.8.0.tar.gz
RUN tar -zxvf pysvn-1.8.0.tar.gz && cd pysvn-1.8.0 && python setup.py install; exit 0
RUN ln -s /pysvn-1.8.0/Source/pysvn /usr/local/lib/python2.7/site-packages/pysvn
@vane
vane / test_runner.py
Created July 6, 2018 18:09
Python dirty way to run unit tests in order
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import unittest
def make_suite():
class Test(unittest.TestCase):
def test_32(self):
print "32"
def test_23(self):
@vane
vane / migrate_encoding.py
Last active July 6, 2018 11:35
Migrate mysql encoding by default to utf8mb4 and utf8mb4_unicode_ci
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import getpass
import _mysql
import argparse
def execute(conn, query):
conn.query(query)
result = conn.store_result()