Skip to content

Instantly share code, notes, and snippets.

View RANUX's full-sized avatar
🏠
👉JavaScript dev. Open for job offerings

Alexander RANUX

🏠
👉JavaScript dev. Open for job offerings
View GitHub Profile
@RANUX
RANUX / ChatGPT Stable Diffusion prompts generator.txt
Created March 7, 2024 13:49 — forked from bluelovers/ChatGPT Stable Diffusion prompts generator.txt
using ChatGPT as Stable Diffusion prompts generator
Stable Diffusion is an AI art generation model similar to DALLE-2.
Here are some prompts for generating art with Stable Diffusion.
Example:
- A ghostly apparition drifting through a haunted mansion's grand ballroom, illuminated by flickering candlelight. Eerie, ethereal, moody lighting.
- portait of a homer simpson archer shooting arrow at forest monster, front game card, drark, marvel comics, dark, smooth
- pirate, deep focus, fantasy, matte, sharp focus
- red dead redemption 2, cinematic view, epic sky, detailed, low angle, high detail, warm lighting, volumetric, godrays, vivid, beautiful
- a fantasy style portrait painting of rachel lane / alison brie hybrid in the style of francois boucher oil painting, rpg portrait

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.
@RANUX
RANUX / fields.py
Created September 16, 2021 12:45 — forked from ramsrib/fields.py
A form field to handle validation of image + svg in Django 3
import sys
import xml.etree.cElementTree as et
from io import BytesIO
from django.core.exceptions import ValidationError
from django.core.validators import (
FileExtensionValidator,
get_available_image_extensions,
)
from django.forms import ImageField as DjangoImageField
@RANUX
RANUX / settings.py
Created February 23, 2021 15:11 — forked from andreagrandi/settings.py
Sending emails from Django during development without using a real SMTP server. Python comes with a very basic and integrated SMTP server. To start it just open a terminal and type: python -m smtpd -n -c DebuggingServer localhost:1025 Then configure your settings.py using the following parameters. You will see the email directly in the terminal …
if DEBUG:
EMAIL_HOST = 'localhost'
EMAIL_PORT = 1025
EMAIL_HOST_USER = ''
EMAIL_HOST_PASSWORD = ''
EMAIL_USE_TLS = False
DEFAULT_FROM_EMAIL = 'testing@example.com'
@RANUX
RANUX / Dockerfile.fails
Created March 16, 2020 14:10 — forked from briceburg/Dockerfile.fails
docker - example adding www-data user to alpine images
FROM nginx:alpine
# stock verison from php:alpine image
# ensure www-data user exists
RUN set -x \
&& addgroup -g 82 -S www-data \
&& adduser -u 82 -D -S -G www-data www-data
# 82 is the standard uid/gid for "www-data" in Alpine
# http://git.alpinelinux.org/cgit/aports/tree/main/apache2/apache2.pre-install?h=v3.3.2
@RANUX
RANUX / basic-tcp-server.dart
Created February 12, 2020 08:16 — forked from mgechev/basic-tcp-server.dart
Basic TCP server in Dart
import 'dart:core';
import 'dart:async';
import 'dart:io';
void startServer() {
Future<ServerSocket> serverFuture = ServerSocket.bind('0.0.0.0', 55555);
serverFuture.then((ServerSocket server) {
server.listen((Socket socket) {
socket.listen((List<int> data) {
String result = new String.fromCharCodes(data);
@RANUX
RANUX / ps1.py
Created October 16, 2019 14:17 — forked from webstory/ps1.py
Python and Nodejs with subprocess
#-*- coding: utf-8 -*-
import subprocess
if __name__ == '__main__':
ps = subprocess.Popen(['nodejs','ps2.js'], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
out = ps.communicate(input='http://www.daum.net'.encode())[0]
print(out.decode('utf-8'))
@RANUX
RANUX / gist:51e7ddb77cff340a549f18e20bdcad6a
Created September 12, 2019 09:21 — forked from CristinaSolana/gist:1885435
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@RANUX
RANUX / admin.py
Created August 31, 2019 06:42 — forked from elidickinson/admin.py
Using CKEditor with Flatpages
from django.contrib import admin
from django.contrib.flatpages.models import FlatPage
# Note: we are renaming the original Admin and Form as we import them!
from django.contrib.flatpages.admin import FlatPageAdmin as FlatPageAdminOld
from django.contrib.flatpages.admin import FlatpageForm as FlatpageFormOld
from django import forms
from ckeditor.widgets import CKEditorWidget