Skip to content

Instantly share code, notes, and snippets.

@kirshiyin89
kirshiyin89 / remove_packages_async.py
Last active Jun 17, 2021
Remove python packages with PyWebIO async
View remove_packages_async.py
from pywebio.output import *
from pywebio.input import *
from pip import _internal
from pip._internal.utils.misc import get_installed_distributions
import time
import asyncio
put_markdown('Pip Package Manager')
installed_packages = get_installed_distributions()
@kirshiyin89
kirshiyin89 / remove_packages.py
Last active Jun 17, 2021
Uninstall python packages in PyWebIO GUI
View remove_packages.py
from pywebio.output import *
from pywebio.input import *
from pip import _internal
from pip._internal.utils.misc import get_installed_distributions
import time
put_markdown('Pip Package Manager')
installed_packages = get_installed_distributions()
installed_packages_set = { package for package in ["%s==%s" % (i.key, i.version)
@kirshiyin89
kirshiyin89 / wordcloud_maker.py
Last active Jun 16, 2021
Create word clouds with shape
View wordcloud_maker.py
from wordcloud import WordCloud
import matplotlib.pyplot as plt
import numpy as np
from PIL import Image
import requests
import csv
file_ob = open(r"feedback.csv")
# read the feedback file
@kirshiyin89
kirshiyin89 / wordcloud_maker_noshape.py
Last active Jun 16, 2021
Create word cloud without shape
View wordcloud_maker_noshape.py
from wordcloud import WordCloud
import matplotlib.pyplot as plt
import csv
file_ob = open(r"feedback.csv")
# read the feedback file
reader_ob = csv.reader(file_ob)
reader_contents = list(reader_ob)
words = ""
@kirshiyin89
kirshiyin89 / data.dart
Created Jun 11, 2021
Call to Datamuse api to retreive the data.
View data.dart
import 'dart:async';
import 'package:http/http.dart' as http;
import 'dart:convert' as convert;
class BackendService {
static Future<List<Map<String, String>>> getSuggestions(String query) async {
if (query.isEmpty && query.length < 3) {
print('Query needs to be at least 3 chars');
return Future.value([]);
}
@kirshiyin89
kirshiyin89 / material_app.dart
Last active Jun 11, 2021
MaterialApp class.
View material_app.dart
import 'package:flutter/material.dart';
import 'package:flutter_typeahead/flutter_typeahead.dart';
import 'data.dart';
class MyMaterialApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Datamuse Autocomplete Demo',
home: MyHomePage(),
@kirshiyin89
kirshiyin89 / qrcode_scanner.py
Last active Jun 7, 2021
QR code generator from a csv file
View qrcode_scanner.py
import qrcode
from csv import DictReader
with open('herbs.csv', 'r') as read_obj:
csv_dict_reader = DictReader(read_obj)
for row in csv_dict_reader:
print(row['Name'], row['Details'])
data = row['Details']
qr = qrcode.QRCode(
version=1,
View qrcode_scanner.py
import qrcode
qr = qrcode.QRCode(
version=1,
error_correction=qrcode.constants.ERROR_CORRECT_L,
box_size=5,
border=4,
)
data = 'Peppermint. Uses: indigestion, nausea. Steep time: 5-10 mins.'
qr.add_data(data)
qr.make(fit=True)
@kirshiyin89
kirshiyin89 / image-similarity-measures
Created May 3, 2021
image-similarity-measures command line
View image-similarity-measures
image-similarity-measures --query_image=orig.jpeg --data_image=test.jpeg
@kirshiyin89
kirshiyin89 / red_apple_results
Created May 2, 2021
result of image similarity red apple
View red_apple_results
The difference between dataset/red_pear.jpg and the original image is :
0.8827639040117994
The difference between dataset/cherry.jpg and the original image is :
0.8542221298727691
The difference between dataset/green_apple.jpg and the original image is :
0.9379929447852137
The closest value: 0.9379929447852137
######################################################################
The difference between dataset/red_pear.jpg and the original image is :
0.018479494