Skip to content

Instantly share code, notes, and snippets.

@AnthoniG
AnthoniG / mern-server-setup.md
Last active June 20, 2022 19:00 — forked from bradtraversy/mern-server-setup.md
Setup Ubuntu & Deploy MERN app

Brad's Youtube Duide

Linux Server Setup & MERN App Deployment

These are the steps to setup an Ubuntu server from scratch and deploy a MERN app with the PM2 process manager and Nginx. We are using Linode, but you could just as well use a different cloud provider or your own machine or VM.

Create an account at Linode

Click on Create Linode

Choose your server options (OS, region, etc)

@AnthoniG
AnthoniG / example.py
Created July 16, 2022 23:52
Python – CellRendererText in GTK+ 3
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")
@AnthoniG
AnthoniG / app.py
Created July 18, 2022 14:26 — forked from carlos-jenkins/app.py
How to programatically add new menu items to menu item in PyGObject.
"""
Hierarchy is:
- GtkMenuBar
- GtkMenuItem
- GtkMenu
- GtkMenuItem
- GtkImageMenuItem
- GtkCheckMenuItem
- GtkRadioMenuItem
- GtkSeparatorMenuItem
#!/usr/bin/env python3
# Python imports
import sys
# GTK imports
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gio
from gi.repository import Gtk
@AnthoniG
AnthoniG / gtk4_template.py
Created July 19, 2022 04:57
python GTK4 app template
# 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…
@AnthoniG
AnthoniG / browser-colors.ts
Created July 21, 2022 07:47
browser-colors
{
"aliceblue",
"antiquewhite",
"aqua",
"aquamarine",
"azure",
"beige",
"bisque",
"black",
"blanchedalmond",
@AnthoniG
AnthoniG / main.dart
Created August 3, 2022 07:52 — forked from AdamJonsson/main.dart
An example how different widget can be used to expand and collapse content in Flutter
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(
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,
@AnthoniG
AnthoniG / aes-256-cbc.js
Created September 6, 2022 11:51 — forked from siwalikm/aes-256-cbc.js
AES-256-CBC implementation in nodeJS with built-in Crypto library
'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) => {
@AnthoniG
AnthoniG / encrypt-decrypt_in_node.js
Created September 6, 2022 11:51 — forked from siwalikm/encrypt-decrypt_in_node.js
Encryption and decryption with Nodejs crypto
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;
}