Skip to content

Instantly share code, notes, and snippets.

View bachdgvn's full-sized avatar

Bách Dương bachdgvn

View GitHub Profile
@bachdgvn
bachdgvn / how-to.md
Last active March 23, 2022 09:32 — forked from reywood/how-to.md
How to get a stack trace from a stuck/hanging python script

How to get a stack trace for each thread in a running python script

Sometimes a python script will simply hang forever with no indication of where things went wrong. Perhaps it's polling a service that will never return a value that allows the program to move forward. Here's a way to see where the program is currently stuck.

Install gdb and pyrasite

Install gdb.

# Redhat, CentOS, etc
{
"name": "LGO SYM",
"symbol": "SYM",
"description": "SYM is LGO symbol",
"image": "https://logos-world.net/wp-content/uploads/2020/04/Huawei-Logo.png",
"animation_url": "https://media.giphy.com/media/lJNoBCvQYp7nq/giphy.gif",
"external_url": "https://vnexpress.net/",
"properties": {
"files": [
{
@bachdgvn
bachdgvn / AdbCommands
Created November 9, 2020 02:48 — forked from Pulimet/AdbCommands
Adb useful commands list
adb help // List all comands
== Adb Server
adb kill-server
adb start-server
== Adb Reboot
adb reboot
adb reboot recovery
adb reboot-bootloader
Phường Tân Định, Quận 1
Phường Đa Kao, Quận 1
Phường Bến Nghé, Quận 1
Phường Bến Thành, Quận 1
Phường Nguyễn Thái Bình, Quận 1
Phường Phạm Ngũ Lão, Quận 1
Phường Cầu Ông Lãnh, Quận 1
Phường Cô Giang, Quận 1
Phường Nguyễn Cư Trinh, Quận 1
Phường Cầu Kho, Quận 1
Verifying my Blockstack ID is secured with the address 1M5z7UZFY7jDgqZjpgzBaY8bnfKvz6PDEG https://explorer.blockstack.org/address/1M5z7UZFY7jDgqZjpgzBaY8bnfKvz6PDEG
function canvas2Blob(canvas) {
var dataURI = canvas.toDataURL();
// convert base64 to raw binary data held in a string
// doesn't handle URLEncoded DataURIs
var byteString = atob(dataURI.split(',')[1]);
// separate out the mime component
var mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0];
@bachdgvn
bachdgvn / docker-compose.yml
Created February 19, 2019 15:18 — forked from gaui/docker-compose.yml
Docker compose for a Docker-in-docker gitlab runners setup
# Docker-in-Docker Gitlab runners setup taken from:
# https://medium.com/@tonywooster/docker-in-docker-in-gitlab-runners-220caeb708ca
dind:
restart: always
privileged: true
volumes:
- /var/lib/docker
image: docker:17.09.0-ce-dind
command:
- --storage-driver=overlay2
@bachdgvn
bachdgvn / docker-compose.yml
Created February 19, 2019 15:18 — forked from nietzscheson/docker-compose.yml
My docker-compose.yml for development
gitlab:
image: 'gitlab/gitlab-ce:latest'
container_name: gitlab
restart: always
hostname: 'gitlab.mcu.dc'
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'http://gitlab.mcu.dc:8090'
gitlab_rails['gitlab_shell_ssh_port'] = 2290
gitlab_rails['smtp_enable'] = true
pragma solidity ^0.5.0;
contract BCertz {
uint public certID;
address public owner;
uint public certCount;
struct Record {
address studentAddress;
@bachdgvn
bachdgvn / broadcast-txs-offline.js
Created January 18, 2019 04:50
Nodejs: How to broadcast raw transaction offline?
const Web3 = require('web3')
const Tx = require('ethereumjs-tx')
// connect to Infura node
const web3 = new Web3(new Web3.providers.HttpProvider('https://rinkeby.infura.io/v3/3ee6d9d1b4454acea9e493bb66ed8e1c'))
// the address that will send the test transaction
const addressFrom = '0xFeBC5F91863Fc1a253362ddaD46537170Fdc61e5'
const privKey = 'xxxxxxxxxxxxxxxxxxx_METAMASKxxxxxxxxxxxxxxxxxxxx'