Skip to content

Instantly share code, notes, and snippets.

@mahdimaymandi
mahdimaymandi / jwtRS256.sh
Created May 20, 2020 19:57 — forked from ygotthilf/jwtRS256.sh
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub
@mahdimaymandi
mahdimaymandi / clipboard.dart
Created August 31, 2020 23:00 — forked from bergwerf/clipboard.dart
Copy to clipboard for Dart
/// A hack to copy a string to the clipboard.
bool _copyToClipboardHack(String text) {
final textarea = new TextAreaElement();
document.body.append(textarea);
textarea.style.border = '0';
textarea.style.margin = '0';
textarea.style.padding = '0';
textarea.style.opacity = '0';
textarea.style.position = 'absolute';
textarea.readOnly = true;
@mahdimaymandi
mahdimaymandi / clipboard.dart
Created August 31, 2020 23:00 — forked from bergwerf/clipboard.dart
Copy to clipboard for Dart
/// A hack to copy a string to the clipboard.
bool _copyToClipboardHack(String text) {
final textarea = new TextAreaElement();
document.body.append(textarea);
textarea.style.border = '0';
textarea.style.margin = '0';
textarea.style.padding = '0';
textarea.style.opacity = '0';
textarea.style.position = 'absolute';
textarea.readOnly = true;
@mahdimaymandi
mahdimaymandi / toBinary.py
Last active November 25, 2020 18:07
Python Decimal To Binary
import math
def toBinary(num):
powers = []
while num > 0:
power = int(math.log(num)/math.log(2))
powers.append(power)
num -= pow(2, power)
i = 0
binaryString = ""
while len(powers) > 0: