
For You - A Song I Wrote Last Year I wrote this song last year and it wasn't sounding great at the start but I think I really worked it out towards the end, getting the right blend of synthesizer and drums together for a good finish and a real orchestral feel. I hope you enjoy this synthesizer soundscape.

A JavaScript Drawing - Coffee Mug I created this simple drawing with code today as a product photo for the new buttons. It's a drawing of a coffee mug, made by using ovals and rectangles. The code that draws it is below.
function init() {
var stage = new createjs.Stage("coffee");
var background = new createjs.Shape();
var yoffset = 40;
background.graphics.beginFill("DeepSkyBlue").drawRect(0, 0, 500, 500);
stage.addChild(background);
var circle = new createjs.Shape();
circle.graphics.beginFill("White").drawEllipse(10 + 300 + yoffset, 250 - 150, 120, 300);
stage.addChild(circle);
var circle3 = new createjs.Shape();
circle3.graphics.beginFill("DeepSkyBlue").drawEllipse(370, 90 + yoffset, 70, 240);
stage.addChild(circle3);
var mug = new createjs.Shape();
mug.graphics.beginFill("White").drawRect(100, 60 + yoffset, 300, 300);
stage.addChild(mug);
var circle = new createjs.Shape();
circle.graphics.beginFill("White").drawEllipse(250 - 150, 10 + yoffset, 300, 100);
stage.addChild(circle);
var circle2 = new createjs.Shape();
circle2.graphics.beginFill("Brown").drawEllipse(250 - 130, 30 + yoffset, 260, 60);
stage.addChild(circle2);
var circle4 = new createjs.Shape();
circle4.graphics.beginFill("White").drawEllipse(250 - 150, 10 + 300 + yoffset, 300, 100);
stage.addChild(circle4);
stage.update();
}

@Jasper_Holton, likes this,

How to Make a Dynamic Easy-Reading Theme Based on Sunrise and Sunset This code lets me automatically render pages in either light or dark mode (with light or dark styles) depending on whether the sun is up. I am querying the location and timezone info using an API. This is a great way to make a site easier on the eyes at night. A webpage with a lot of white blank space in it can be a little bit hard to use at night, so it's better to have a context processor that makes the site easier to read at night.
# app/context_processors.py
import pytz
from astral import LocationInfo
from astral.sun import sun
def context_processor(context_data)
tz = request.user.profile.timezone # Get the timezone
city = LocationInfo(request.user.profile.city, request.user.profile.country, tz, request.user.profile.lat, request.user.profile.lon) # Using astral to query location by city, country, timezone, latitude and longitude
city_sun = sun(city.observer, date=datetime.now(pytz.timezone(tz))) # get
the city sunlight
now_time = datetime.now(pytz.timezone(tz)).time() # Get the time now
if now_time <= city_sun['sunrise'].astimezone(pytz.timezone(tz)).time() or now_time >= city_sun['sunset'].astimezone(pytz.timezone(tz)).time(): # If the sun is down
context_data['darkmode'] = True # Make the page dark
else:
context_data['darkmode'] = False # Or otherwise make it light
return context_data
# users/middleware.py
def simple_middleware(get_response):
# One-time configuration and initialization.
def middleware(request):
User = get_user_model()
if request.user.is_authenticated and hasattr(request.user, 'profile'):
user = get_object_or_404(User, pk=request.user.pk)
# Update last visit time after request finished processing.
last_ip = request.user.profile.ip
request.user.profile.ip = get_client_ip(request)
if request.user.profile.ip != last_ip:
request.user.profile.timezone = get_timezone(request.user.profile.ip)
response = requests.get('http://https://ipinfo.io/' + request.user.profile.ip + '/json' ).json() # Get the IP info
request.user.profile.city = response['city'] # Save it
request.user.profile.country = response['country']
request.user.profile.timezone = response['timezone']
request.user.profile.lat = response['loc'].split(',')[0]
request.user.profile.lon = response['loc'].split(',')[1]
request.user.profile.save()
response = get_response(request)
return response
return middleware

You Can Now Make Money on Uglek! Uglek now supports some payment and payout features. Make money on Uglek by registering for an account and going to your profile (from the navbar). Then click the button at the bottom inviting you to accept payments, and fill out the forms. Now, other people can pay you on your profile and subscribe if they have an account on Uglek (for monthly payments). You can also post private posts to the "members" topic which can't be loaded, and the image can't be seen without a membership. Users can log in on your profile and become a member, or just give you support without requiring you to log in. Be sure to check out my shiny new buttons at uglek.com/user/Jasper_Holton/. Thanks for being here!
@Jasper_Holton, @Spinning_image, like this,

Here is another song I created tonight This is a simple electronic instrumental in my usual style. I hope you like it!
@Spinning_image, likes this,

More Beauty from the Forest in Washington Out hiking with @AussieinthePNW

@Jasper_Holton, likes this,
© Uglek, 2022