Skip to content

Instantly share code, notes, and snippets.

View shujaatak's full-sized avatar

Shujaat Ali Khan shujaatak

View GitHub Profile
@shujaatak
shujaatak / Building OpenSSL 1.1.1(b) Notes
Last active September 7, 2023 10:58 — forked from csm10495/Building OpenSSL 1.1.1(b) Notes
Building OpenSSL 1.1.1(b) Notes (Windows)
Required: Visual Studio 2015 or 2017 (or probably later works)
Setup
1. Clone/download OpenSSL 1.1.1 source to a folder
2. Download / install Perl (They recommend Active perl)
I recommend using Chocolatey so for me: choco install activeperl
3. Ensure Perl is in the system path. (Choco appears to do this by default)
4. Download / install NASM
I recommend using Chocolatey so for me: choco install nasm
5. Ensure NASM is in the system path. (For me the directory to add was C:\Program Files\NASM)
// vscode-keybindings for navigation with I/J/K/L and additional functionality with surrounding characters
// Place your key bindings in this file to overwrite the defaults
// ALT + I/J/K/L: up/left/down/right
// ALT + SHIFT + I/J/K/L: mark text up/left/down/right
// CTRL + J/L: send cursor to start/end of line
// CTRL + ALT + J/L: send cursor to start/end of word
// CTRL + ALT + U/O: send cursor to "wordPartLeft"/"wordPartRight"
// CTRL + ALT + SHIFT + U/O: mark from cursor to "wordPartLeft"/"wordPartRight"
// CTRL + ALT + Y: got to declaration
@shujaatak
shujaatak / calc_pi.py
Created September 3, 2021 07:50 — forked from highfestiva/calc_pi.py
Calculate PI with an incredibly low accuracy
#!/usr/bin/env python3
import sys
terms = (int(sys.argv[1]) + 1) // 2
pi = 4 + sum(4/-(v*4+3) + 4/(v*4+5) for v in range(terms))
print(pi)
@shujaatak
shujaatak / main.dart
Created June 8, 2021 10:33 — forked from roipeker/main.dart
GraphX issue #19: simpler gesture transform (zoom, drag, rotate)
/// live demo: https://graphx-gesture-simple.surge.sh
import 'package:flutter/material.dart';
import 'package:graphx/graphx.dart';
import 'package:graphx_zoompan/simple_zoom.dart';
void main() {
runApp(AppSimpleZoom());
}
@shujaatak
shujaatak / main.dart
Created June 8, 2021 10:32 — forked from roipeker/main.dart
GraphX issue #19: gesture detector sample (zoom/pan/rotation with easing)
import 'package:flutter/material.dart';
import 'package:graphx/graphx.dart';
import 'zoom_scene.dart';
/// Live demo:
/// https://graphx-gesture-sample.surge.sh
///
void main() {
import sys
import time
from PyQt5.QtCore import (QCoreApplication, QObject, QRunnable, QThread,
QThreadPool, pyqtSignal)
# Subclassing QThread
# http://qt-project.org/doc/latest/qthread.html
class AThread(QThread):
@shujaatak
shujaatak / qprogressbar_thread.py
Created June 5, 2021 11:16 — forked from kaotika/qprogressbar_thread.py
Simple PyQt example with QThread and QProgressBar
from PyQt4 import QtCore, QtGui
import sys, time
class mythread(QtCore.QThread):
total = QtCore.pyqtSignal(object)
update = QtCore.pyqtSignal()
def __init__(self, parent, n):
super(mythread, self).__init__(parent)
@shujaatak
shujaatak / threads1.py
Created June 5, 2021 11:15 — forked from jazzycamel/threads1.py
Simple example of the correct way to use (Py)Qt(5) and QThread
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from itertools import count, islice
class Threaded(QObject):
result=pyqtSignal(int)
def __init__(self, parent=None, **kwargs):
super().__init__(parent, **kwargs)
# Using QThreads in PyQt5 using worker model
# There is so many conflicting posts on how QThreads should be used in pyqt. I had
# been subclassing QThread, overriding the run function, and calling start to run
# the thread. I did it this way, because I couldn't get the worker method (where
# an object is moved to a thread using moveToThread) to do what I wanted. It turns
# out that I just didn't understand why. But, once I worked it out I have stuck with
# the moveToThread method, as this is recommended by the official docs.
#
# The key part for me to understand was that when I am running a heavy calculation in
@shujaatak
shujaatak / plotting_QThread.py
Created June 5, 2021 04:14 — forked from mhogg/plotting_QThread.py
How to use QThreads in pyqt
# Code to show two plots of simulated streamed data. Data for each plot is processed (generated)
# by separate threads, and passed back to the gui thread for plotting.
# This is an example of using movetothread, which is the correct way of using QThreads
# Michael Hogg, 2015
import time, sys
from pyqtgraph.Qt import QtGui, QtCore
from PyQt4.Qt import QMutex
import pyqtgraph as pg