Skip to content

Instantly share code, notes, and snippets.

View vassilyvv's full-sized avatar

Vassily vassilyvv

  • Bishkek, Kyrgyzstan
View GitHub Profile
@vassilyvv
vassilyvv / killport.sh
Created January 1, 2023 10:24
kill port on macos
#!/bin/bash
if [ -z "$1" ]
then
echo "Port not specified"
else
greparray=$(lsof -i tcp:$1 | grep -Eo "\s(\d{5})\s")
for pid in $greparray
do
kill -9 $pid
echo $pid
@vassilyvv
vassilyvv / gist:bb70833bf546a5bfbd586f1aaf29b30d
Created July 11, 2021 10:25
Send ERC20 Token with python
from web3 import Web3
# or local url
INFURA_URL = "https://mainnet.infura.io/v3/<some_id>"
PRIVATE_KEY = b'<32 characters>'
web3 = Web3(Web3.HTTPProvider(INFURA_URL))
print(web3.isConnected())
@vassilyvv
vassilyvv / Dockerfile-chrome-headless
Created February 25, 2019 12:36
Installing headless chrome browser into docker container
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
RUN sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
RUN apt-get update
RUN apt --fix-broken install
RUN apt-get install google-chrome-stable -y

Issue:

Docker: resource or device is busy

Solution:

cat /proc/mounts |grep docker
sudo umount /path

Source

@vassilyvv
vassilyvv / get_hl_images.sh
Last active February 7, 2018 19:57
Get actual hyperledger fabric images
#!/bin/bash
#
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
# source: https://raw.githubusercontent.com/hyperledger/fabric/v1.0.5/scripts/bootstrap.sh
# current version of fabric released
# TODO: replace with latest version of fabric!
@vassilyvv
vassilyvv / pyre_btc.py
Last active February 12, 2018 17:38
Interaction with bitcoind via pure python
from __future__ import print_function
import requests, json
# Default port for the bitcoin testnet is 18332
# The port number depends on the one writtein the bitcoin.conf file
rpcPort = 18332
# The RPC username and RPC password MUST match the one in your bitcoin.conf file
rpcUser = 'gurdurbur'
rpcPassword = 'murmurmur'
@vassilyvv
vassilyvv / fcm_pure.py
Last active November 23, 2018 09:57
Sends data-only-payloaded message to FCM topic
# coding: utf-8
import requests, json
API_KEY = ""
url = "https://fcm.googleapis.com/fcm/send"
body = {
"to": "/topics/ru",
"data": {
"title":"mytitle",