This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const crypto = require('crypto'); | |
| const algorithm = 'aes-256-ctr'; | |
| let key = 'MySuperSecretKey'; | |
| key = crypto.createHash('sha256').update(String(key)).digest('base64').substr(0, 32); | |
| const encrypt = (buffer) => { | |
| // Create an initialization vector | |
| const iv = crypto.randomBytes(16); | |
| // Create a new cipher using the algorithm, key, and iv | |
| const cipher = crypto.createCipheriv(algorithm, key, iv); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var crypto = require('crypto'), | |
| algo = 'aes-256-cbc', | |
| key = 'super123secretKey!'; | |
| function encrypt(text){ | |
| var cipher = crypto.createCipher(algo,key) | |
| var crypted = cipher.update(text,'utf8','hex') | |
| crypted += cipher.final('hex'); | |
| return crypted; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict'; | |
| const crypto = require('crypto'); | |
| const ENC_KEY = "bf3c199c2470cb477d907b1e0917c17b"; // set random encryption key | |
| const IV = "5183666c72eec9e4"; // set random initialisation vector | |
| // ENC_KEY and IV can be generated as crypto.randomBytes(32).toString('hex'); | |
| const phrase = "who let the dogs out"; | |
| var encrypt = ((val) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/widgets.dart'; | |
| import 'package:flutter_hooks/flutter_hooks.dart'; | |
| // adapted from https://stackoverflow.com/a/54173729/67655 | |
| class ExpandableSection extends HookWidget { | |
| const ExpandableSection({ | |
| Key key, | |
| this.expanded = false, | |
| this.child, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/material.dart'; | |
| void main() => runApp(MyApp()); | |
| class MyApp extends StatelessWidget { | |
| @override | |
| Widget build(BuildContext context) { | |
| return MaterialApp( | |
| title: 'Expanding Demo', | |
| theme: ThemeData( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "aliceblue", | |
| "antiquewhite", | |
| "aqua", | |
| "aquamarine", | |
| "azure", | |
| "beige", | |
| "bisque", | |
| "black", | |
| "blanchedalmond", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Load Gtk | |
| import gi | |
| gi.require_version('Gtk', '4.0') | |
| from gi.repository import Gtk | |
| # When the application is launched… | |
| def on_activate(app): | |
| # … create a new window… | |
| win = Gtk.ApplicationWindow(application=app) | |
| # … with a button in it… |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Hierarchy is: | |
| - GtkMenuBar | |
| - GtkMenuItem | |
| - GtkMenu | |
| - GtkMenuItem | |
| - GtkImageMenuItem | |
| - GtkCheckMenuItem | |
| - GtkRadioMenuItem | |
| - GtkSeparatorMenuItem |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from gi.repository import Gtk | |
| import gi | |
| gi.require_version("Gtk", "3.0") | |
| class CellRendererTextWindow(Gtk.Window): | |
| def __init__(self): | |
| Gtk.Window.__init__(self, title ="Geeks For Geeks") | |