Skip to content

Instantly share code, notes, and snippets.

View hosseinzoda's full-sized avatar

Hossein Zoda hosseinzoda

View GitHub Profile
@hosseinzoda
hosseinzoda / change.js
Last active October 21, 2020 14:50
How to change prediction of dynamic nodes.
/*
There are two functions in main.js for letter or word predition, You can modify it with _tree_dynamic_nodes_module_map variable
*/
// html/js/main.js L2063
var _tree_dynamic_nodes_module_map = {
'trees-switcher': {
render: _trees_switcher_dynamic_nodes,
},
'spell-word-prediction': {
@hosseinzoda
hosseinzoda / imagereplace-qt.py
Last active April 17, 2019 16:00 — forked from willwade/imagereplace-qt.py
Grid3 Image Replacer. Take a file like this one: https://www.dropbox.com/s/ik1u0nzp7n6zfu6/Original.gridset?dl=0 - and find some new images to replace in the zip file
# this reads grid 3 files. Finds image in one grid page and same one in another and replaces it with a new one
import zipfile
from google_images_download import google_images_download
import re
import os, shutil
from glob import glob
from sys import exit, argv, exc_info, stderr
from PyQt5.QtCore import pyqtSignal, Qt
@hosseinzoda
hosseinzoda / serve_http.py
Created April 12, 2019 17:39 — forked from pankajp/serve_http.py
Simple Python HTTP Server with multi-threading and partial-content support
#! /usr/bin/env python
# Standard library imports.
from SocketServer import ThreadingMixIn
import BaseHTTPServer
import SimpleHTTPServer
import sys
import json
import os
from os.path import (join, exists, dirname, abspath, isabs, sep, walk, splitext,
@hosseinzoda
hosseinzoda / README.md
Last active August 19, 2021 15:29
UWP BLE Gatt Server Advertising Not Supported, IsPeripheralRoleSupported = FALSE

I intend to gather a list of bluetooth internal/usb adapters that support or do not support advertising Gatt services.

These Devices may support advertising on bluetooth/ble. But the Windows 10 GattServiceProvider do support advertising on it. With this error, The device does not support the command feature. WinRT information: The Bluetooth adapter does not support peripheral role.

Test project on Vistual Studio: https://github.com/hosseinamin/UWPBleGattAdvTest

@hosseinzoda
hosseinzoda / IE-dom-issues-and-fixes.js
Last active August 23, 2018 13:20
IE dom issues & fixes
// There's an issue with IE, instead of Node having prototype contains,
// HTMLElement has it. Simple fix is to set the function for Node too
if (typeof Node != 'undefined' && typeof HTMLElement != 'undefined' &&
!Node.prototype.contains && HTMLElement.prototype.contains) {
Node.prototype.contains = HTMLElement.prototype.contains;
}

Keybase proof

I hereby claim:

  • I am hosseinamin on github.
  • I am hosseinamin (https://keybase.io/hosseinamin) on keybase.
  • I have a public key ASAg6Z8lb-F-olCHGD7w0yAfj3XGeJsLnd7mWJ7SO4Z1Lgo

To claim this, I am signing this object:

@hosseinzoda
hosseinzoda / print-password.py
Last active April 8, 2018 15:49
Get new password!
#!/bin/env /usr/bin/python3
from sys import argv
from os import urandom
from math import floor
def mkpasswd(n, chars="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-=_+{}|\/?,<>"):
ret = ""
charsn=len(chars)
while n > 0:
@hosseinzoda
hosseinzoda / promise.prototype.finally.js
Last active March 23, 2017 04:22
Promise.prototype.finally implementation
/**
* I think this is correct implementation of promise.finally,
* Following what synchronized try/catch/finally does
*/
if(!Promise.prototype.finally) {
Promise.prototype.finally = function(f) {
var ret, thr, hasthr = false;
return this.then(function(a){ ret = a; return f(); })
.then(function(){ return ret; })
.catch(function(a) { hasthr = true; thr = a; return f(); })
@hosseinzoda
hosseinzoda / generate variables
Last active April 8, 2018 15:55
Write static strings as variable, e.x glsl shaders
# file2var does generate code to have files as strings in languages like javascript, c
# https://github.com/aminbros/file2var
file2var txt2cstr -p js -o ../src/programs.js *.glsl
# output file is js file containing all .glsl files named with their filename