#python writing text files
Explore tagged Tumblr posts
komaedalovemail · 7 months ago
Note
komaedas have you tried straw.page?
(i hope you don't mind if i make a big ollllle webdev post off this!)
i have never tried straw.page but it looks similar to carrd and other WYSIWYG editors (which is unappealing to me, since i know html/css/js and want full control of the code. and can't hide secrets in code comments.....)
my 2 cents as a web designer is if you're looking to learn web design or host long-term web projects, WYSIWYG editors suck doodooass. you don't learn the basics of coding, someone else does it for you! however, if you're just looking to quickly host images, links to your other social medias, write text entries/blogposts, WYSIWYG can be nice.
toyhouse, tumblr, deviantart, a lot of sites implement WYSIWYG for their post editors as well, but then you can run into issues relying on their main site features for things like the search system, user profiles, comments, etc. but it can be nice to just login to your account and host your information in one place, especially on a platform that's geared towards that specific type of information. (toyhouse is a better example of this, since you have a lot of control of how your profile/character pages look, even without a premium account) carrd can be nice if you just want to say "here's where to find me on other sites," for example. but sometimes you want a full website!
---------------------------------------
neocities hosting
currently, i host my website on neocities, but i would say the web2.0sphere has sucked some doodooass right now and i'm fiending for something better than it. it's a static web host, e.g. you can upload text, image, audio, and client-side (mostly javascript and css) files, and html pages. for the past few years, neocities' servers have gotten slower and slower and had total blackouts with no notices about why it's happening... and i'm realizing they host a lot of crypto sites that have crypto miners that eat up a ton of server resources. i don't think they're doing anything to limit bot or crypto mining activity and regular users are taking a hit.
Tumblr media Tumblr media Tumblr media
↑ page 1 on neocitie's most viewed sites we find this site. this site has a crypto miner on it, just so i'm not making up claims without proof here. there is also a very populated #crypto tag on neocities (has porn in it tho so be warned...).
---------------------------------------
dynamic/server-side web hosting
$5/mo for neocities premium seems cheap until you realize... The Beautiful World of Server-side Web Hosting!
client-side AKA static web hosting (neocities, geocities) means you can upload images, audio, video, and other files that do not interact with the server where the website is hosted, like html, css, and javascript. the user reading your webpage does not send any information to the server like a username, password, their favourite colour, etc. - any variables handled by scripts like javascript will be forgotten when the page is reloaded, since there's no way to save it to the web server. server-side AKA dynamic web hosting can utilize any script like php, ruby, python, or perl, and has an SQL database to store variables like the aforementioned that would have previously had nowhere to be stored.
there are many places in 2024 you can host a website for free, including: infinityfree (i use this for my test websites :B has tons of subdomains to choose from) [unlimited sites, 5gb/unlimited storage], googiehost [1 site, 1gb/1mb storage], freehostia [5 sites/1 database, 250mb storage], freehosting [1 site, 10gb/unlimited storage]
if you want more features like extra websites, more storage, a dedicated e-mail, PHP configuration, etc, you can look into paying a lil shmoney for web hosting: there's hostinger (this is my promocode so i get. shmoney. if you. um. 🗿🗿🗿) [$2.40-3.99+/mo, 100 sites/300 databases, 100gb storage, 25k visits/mo], a2hosting [$1.75-12.99+/mo, 1 site/5 databases, 10gb/1gb storage], and cloudways [$10-11+/mo, 25gb/1gb]. i'm seeing people say to stay away from godaddy and hostgator. before you purchase a plan, look up coupons, too! (i usually renew my plan ahead of time when hostinger runs good sales/coupons LOL)
here's a big webhost comparison chart from r/HostingHostel circa jan 2024.
Tumblr media
---------------------------------------
domain names
most of the free website hosts will give you a subdomain like yoursite.has-a-cool-website-69.org, and usually paid hosts expect you to bring your own domain name. i got my domain on namecheap (enticing registration prices, mid renewal prices), there's also porkbun, cloudflare, namesilo, and amazon route 53. don't use godaddy or squarespace. make sure you double check the promo price vs. the actual renewal price and don't get charged $120/mo when you thought it was $4/mo during a promo, certain TLDs (endings like .com, .org, .cool, etc) cost more and have a base price (.car costs $2,300?!?). look up coupons before you purchase these as well!
namecheap and porkbun offer something called "handshake domains," DO NOT BUY THESE. 🤣🤣🤣 they're usually cheaper and offer more appealing, hyper-specific endings like .iloveu, .8888, .catgirl, .dookie, .gethigh, .♥, .❣, and .✟. I WISH WE COULD HAVE THEM but they're literally unusable. in order to access a page using a handshake domain, you need to download a handshake resolver. every time the user connects to the site, they have to provide proof of work. aside from it being incredibly wasteful, you LITERALLY cannot just type in the URL and go to your own website, you need to download a handshake resolver, meaning everyday internet users cannot access your site.
---------------------------------------
hosting a static site on a dynamic webhost
you can host a static (html/css/js only) website on a dynamic web server without having to learn PHP and SQL! if you're coming from somewhere like neocities, the only thing you need to do is configure your website's properties. your hosting service will probably have tutorials to follow for this, and possibly already did some steps for you. you need to point the nameserver to your domain, install an SSL certificate, and connect to your site using FTP for future uploads. FTP is a faster, alternative way to upload files to your website instead of your webhost's file upload system; programs like WinSCP or FileZilla can upload using FTP for you.
if you wanna learn PHP and SQL and really get into webdev, i wrote a forum post at Mysidia Adoptables here, tho it's sorted geared at the mysidia script library itself (Mysidia Adoptables is a free virtual pet site script, tiny community. go check it out!)
---------------------------------------
file storage & backups
a problem i have run into a lot in my past like, 20 years of internet usage (/OLD) is that a site that is free, has a small community, and maybe sounds too good/cheap to be true, has a higher chance of going under. sometimes this happens to bigger sites like tinypic, photobucket, and imageshack, but for every site like that, there's like a million of baby sites that died with people's files. host your files/websites on a well-known site, or at least back it up and expect it to go under!
i used to host my images on something called "imgjoe" during the tinypic/imageshack era, it lasted about 3 years, and i lost everything hosted on there. more recently, komaedalovemail had its webpages hosted here on tumblr, and tumblr changed its UI so custom pages don't allow javascript, which prevented any new pages from being edited/added. another test site i made a couple years ago on hostinger's site called 000webhost went under/became a part of hostinger's paid-only plans, so i had to look very quickly for a new host or i'd lose my test site.
if you're broke like me, looking into physical file storage can be expensive. anything related to computers has gone through baaaaad inflation due to crypto, which again, I Freaquing Hate, and is killing mother nature. STOP MINING CRYPTO this is gonna be you in 1 year
Tumblr media
...um i digress. ANYWAYS, you can archive your websites, which'll save your static assets on The Internet Archive (which could use your lovely donations right now btw), and/or archive.today (also taking donations). having a webhost service with lots of storage and automatic backups can be nice if you're worried about file loss or corruption, or just don't have enough storage on your computer at home!
if you're buying physical storage, be it hard drive, solid state drive, USB stick, whatever... get an actual brand like Western Digital or Seagate and don't fall for those cheap ones on Amazon that claim to have 8,000GB for $40 or you're going to spend 13 days in windows command prompt trying to repair the disk and thenthe power is gong to go out in your shit ass neighvborhood and you have to run it tagain and then Windows 10 tryes to update and itresets the /chkdsk agin while you're awayfrom town nad you're goig to start crytypting and kts just hnot going tot br the same aever agai nikt jus not ggiog to be the saeme
---------------------------------------
further webhosting options
there are other Advanced options when it comes to web hosting. for example, you can physically own and run your own webserver, e.g. with a computer or a raspberry pi. r/selfhosted might be a good place if you're looking into that!
if you know or are learning PHP, SQL, and other server-side languages, you can host a webserver on your computer using something like XAMPP (Apache, MariaDB, PHP, & Perl) with minimal storage space (the latest version takes up a little under 1gb on my computer rn). then, you can test your website without needing an internet connection or worrying about finding a hosting plan that can support your project until you've set everything up!
there's also many PHP frameworks which can be useful for beginners and wizards of the web alike. WordPress is one which you're no doubt familiar with for creating blog posts, and Bluehost is a decent hosting service tailored to WordPress specifically. there's full frameworks like Laravel, CakePHP, and Slim, which will usually handle security, user authentication, web routing, and database interactions that you can build off of. Laravel in particular is noob-friendly imo, and is used by a large populace, and it has many tutorials, example sites built with it, and specific app frameworks.
---------------------------------------
addendum: storing sensitive data
if you decide to host a server-side website, you'll most likely have a login/out functionality (user authentication), and have to store things like usernames, passwords, and e-mails. PLEASE don't launch your website until you're sure your site security is up to snuff!
when trying to check if your data is hackable... It's time to get into the Mind of a Hacker. OWASP has some good cheat sheets that list some of the bigger security concerns and how to mitigate them as a site owner, and you can look up filtered security issues on the Exploit Database.
this is kind of its own topic if you're coding a PHP website from scratch; most frameworks securely store sensitive data for you already. if you're writing your own PHP framework, refer to php.net's security articles and this guide on writing an .htaccess file.
---------------------------------------
but. i be on that phone... :(
ok one thing i see about straw.page that seems nice is that it advertises the ability to make webpages from your phone. WYSIWYG editors in general are more capable of this. i only started looking into this yesterday, but there ARE source code editor apps for mobile devices! if you have a webhosting plan, you can download/upload assets/code from your phone and whatnot and code on the go. i downloaded Runecode for iphone. it might suck ass to keep typing those brackets.... we'll see..... but sometimes you're stuck in the car and you're like damn i wanna code my site GRRRR I WANNA CODE MY SITE!!!
Tumblr media Tumblr media
↑ code written in Runecode, then uploaded to Hostinger. Runecode didn't tell me i forgot a semicolon but Hostinger did... i guess you can code from your webhost's file uploader on mobile but i don't trust them since they tend not to autosave or prompt you before closing, and if the wifi dies idk what happens to your code.
---------------------------------------
ANYWAYS! HAPPY WEBSITE BUILDING~! HOPE THIS HELPS~!~!~!
-Mod 12 @eeyes
Tumblr media
198 notes · View notes
corseque · 6 months ago
Text
Tumblr media Tumblr media
@selemchant @noxconsortium
Here's a breakdown of what I did
I went through the ">conversations" section, looking for which files actually made up the dialogue trees. It's a little different than Inquisition, but I eventually found that they seem to be within the "FC_ConvFlowLayer" files.
Tumblr media Tumblr media
Frosty actually has the strings linked correctly within these files, but it's very cumbersome to look at in Frosty. I wanted to make it easier to read. When you export these FC_ConvFlowLayer files, they are .xml files that link to numbers instead of strings.
Tumblr media
When you export the raw script of DAV from Frosty Editor, every line is paired with the same matching little numbers (minus the first "0x" for some reason).
The raw script is a .csv file that looks like this:
Tumblr media
So I added an "0x" to every line of the .csv file (so they would match) and then made a python program that found all the strings within the <StringId></StringId> tags in all the xml files, and then looked up the matching number in the Raw Script .csv file and then saved the second column (the text) from the .csv file into the .xml files.
So now instead of numbers, I have strings:
Tumblr media
Now, these .xml files have a lot of information in them that someone smarter than me could figure out how to make a comprehensive dialogue tree out of, because I think all of the information you would need is provided by the xml files. But that's hard and for now I just wanted a .txt file of who spoke what line.
It wasn't hard from there to write another little program to extract just the speaker and the lines into a plain .txt file
Tumblr media
And then to merge all the text files together and use notepad++ and the power of regular expressions to clean them even more:
Tumblr media
IF YOU WOULD LIKE TO PLAY AROUND WITH THE .XML FILES THAT HAVE THE NUMBERS REPLACED WITH STRINGS but that still have all the conversation information intact, like how each of the lines are linked to each other, I uploaded them here on google drive (there are 1500 files, but they're pretty small):
LINK TO THE XML FILES FOR YOU TO DO WHAT YOU WANT WITH
58 notes · View notes
archiveyourblog · 2 months ago
Text
How to back up your Tumblr blog
Not sure if all of you heard the news, but Wordpress laid off 16% of its staff, which happened to include senior tumblr staff like cyle. According to 3liza, the amount of staff running tumblr is about 25.
Welp. Will Tumblr finally die? I don't know. It's pretty likely, since this site costs millions to run and to host all this content, but I'll stay till the end. But I backed up my blog, with the help of a post that can't be reblogged rn.
you can reblog this one though.
Quoth butchlinkle: "In your blog settings you have the ability to initiate a blog export, and this will generate a backup for your blog.
Fair warning though, if you’ve been on the platform for a long time this archive is likely to be quite hefty in file size. This blog I have had for 5 years with 22k posts, and the export from tumblr came to be 48GB. My previous blog I made in 2011 and has 95k posts, so needless to say I did not use tumblr’s built in export to back that one up.
If you want more control over exactly what you back up from your blog, I recommend that you use tumblr-utils instead. It allows you to backup specific tags, post types, and to ignore posts that you did not create (reblogs where you’ve added a comment count unfortunately do not count unless you use the older version of the script made with python 2.7).
To use it:
download and install python
create an application on tumblr to get an api key
create a folder where you would like to save your backups and right click to open it in the terminal/command prompt, or type cmd.exe in the address bar from inside that folder
Tumblr media Tumblr media
Backing up just my original posts from this blog with this command came to 632MB rather than 48GB, and also gave me the option to save my posts in JSON format which will be useful for converting my posts to a new format for self hosting.
On that note I’m currently looking into figuring out a simple (and ideally free) way of self hosting a static site blog that utilises activitypub, and also converting my old posts to re-host on said blog.
This post series by maho.dev on implementing activitypub with any static site is my primary source of guidance atm if you also want to try figure that out yourself, as well as having an explanation for why you’d even want to do this if you don’t already know
but if tumblr goes down before I get things sorted and write up a post about it then i’ll be reporting back on it via my bsky, mastodon, and toyhouse accounts
if you dont have an account on any of these I’ll also be sharing an update via my personal site’s RSS feed, link of which includes an explanation of what RSS is and some feed readers you can use, I highly recommend checking it out as getting a feed reader is going to be the best way you can stay connected with people if they scatter across the internet!
tldr: download tumblr-utils to backup your blog more efficiently, introduce yourself to RSS and get a feed reader to stay connected with people, consider saving mine so you can find out how to self host your blog later if tumblr goes down."
here's a guide from the notes: https://docs.google.com/document/u/0/d/1yBWlk-yEgpSoEh3c9oLhz_kbLtUGqbqzOpCtJsvQgjI/mobilebasic?pli=1#h.u9vj7pezwpcy
Back up those blogs. This was way faster than trying to use Webarchive, and webarchive seems to be only good for saving text, audio, and video, because it saved none of the images. And remember: I did not write this guide, and I do not know a thing about coding or fixing bugs.
8 notes · View notes
moose-mousse · 5 months ago
Note
Greetings moose-mousse, it is a bit niche/weird (but let's see how far it goes) but may I ask for some suggestions / advice concerning making pseudo-code / fake code scripts / programs to put onto scenes to film? Because I work towards portraying sidestream programming environments of the past (yet customized into my own 16^12 worldbuilding stuff) to show for films I look forth to produce this summer and idk where to pull fitting samples, code style guides & whatnot to put on various screens.
A great start. Wireshark. It is a packet sniffer. Especially on wireless networks in looks great as background busywork. Do it to a public network and you will get plenty of noise to look technical. Basically in wireless networks, everyone is just screaming things. Only the intended target really reacts, and things are encrypted and all sorts of safety is in place, but the fact of the matter is still that everyone is screaming. So you can just have wireshark show you everything that is happening, and it gives a nice constant feed of technically valid but essentially nonsense to look at. Customize the look a bit and you are great. Note that this is both legal and fine. This is stuff it is ok to yell about in public The other is of course a command console. For that I would recommend installing Python, and then simply make a infinite loop that prints technical nonsense. If you need sample text then install anything by writing "pip install ______", copy the text and print it in your own python thing. Creates infinite nonsense text that looks real (because... it is a copy of something real.) Both of these should take less than an hour to set up, and will create great looking backgrounds on screens for "someone doing something technical"
If you want code just staying still on the screen, then basically install visual studio code, find an open source project on github and open a file. Open files of a few different types and visual studio code will automatically recommend you extension that will color the text to look like proper code.
8 notes · View notes
becauseplot · 9 months ago
Text
Inktordem!! Posted at a reasonable-ish hour!! I have a feeling I’m gonna have to take a break for a bit so I can make more fic ideas, I need to give my idea doc a bit of a stir. We’ll see how the next few days go though.
Spoilers up through OPD finale!
DAY 8 — BIBLIOTECA
Two days. He’s put this off as much as he reasonably can. The report needs to be written, and the longer he waits, the more details will slip from his mind. Details that could be crucial later down the line. Details that could save lives later down the line. He knows this. That’s why they write reports in the first place. And he’s the one who has to do the writing because Dante’s gone blind and everyone else…
Everyone else.
That’s the thing, isn’t it.
Remembering hurts. It hurts a lot. And it doesn’t stop hurting—it never does—to remember the Liz’s lips spilling over with blood and anguish, Bea’s bright, brilliant scream and Dante’s desperate pleas, Joui’s trembling fingers around the mask, Erin’s hollow smile consumed by the flames, Luciano’s face disappearing into him, Fernando’s last kiss, Kaiser’s—
Arthur puts his pen down and drops his face into his hands, sucking in a tremulous breath. He didn’t think he had any more tears left to cry, and yet…
It’s a few minutes later, when Arthur has wiped his eyes and set the blank report sheet in front of himself again, that he catches movement out of the corner of his eye. It’s Samuel, standing in the doorway between the hall and the main room of the base, where Arthur sits alone at one of the long tables.
“Hey,” Samuel greets. His voice echoes a bit. It’s late enough that most people have gone home to rest, save for Mr. Veríssimo, who never seems to leave his office in times like these, and Marcela, doing a final vitals checks on the wounded before she heads home too. “Uh… All good?”
“Yeah,” Arthur exhales. “Yeah, just—writing this report.” The paper is blank. Arthur taps his pen. “You? How’re you…?”
“Eh,” Samuel says. His mouth does a funny thing, like it can’t decide if it wants to grin or grimace or…something else. He clears his throat a bit. “Holding up, man. Holding up.”
Arthur nods. He can understand that.
There’s a beat of silence just a bit too long. A bit too big. Arthur opens his mouth to ask…something, but Samuel thankfully fills it first.
“Anyway,” says Samuel. “I just wanted to stop over here because—well. I was going through some of the files on Kaiser’s computer.” (Arthur’s chest tightens at the mere mention of the name. He adjusts the grip on his pen.) “Getting his projects archived and all that. And I found this one file that’s… It’s giving me some trouble.”
“Trouble how?”
“It’s got this password and—“ Samuel steps away from the doorframe and motions him forward. “I think it’s easier if I just show you.”
Arthur follows Samuel into the computer room. Only Kaiser’s monitor is on, as are the overhead string lights; Kaiser’s chair has been rolled aside, replaced by Samuel’s own. Samuel moves it aside so Arthur can see the screen better: a display listing many, many, many Python files that Arthur couldn’t even begin to understand the significance of, as well as…
“There it is,” Samuel says, pointing to the pop-up box in the corner of the screen. “I clicked on some file he had I’ve never seen before. It’s just labeled ‘Important.’”
“There’s a password hint here,” Arthur says, pointing to some text below the prompt box. “That’s what that is, right?”
All it says is: “Post on 15/04/20”
“Yeah,” replies Samuel. “That’s what I thought too. I just haven’t been able to figure out what it means. I thought ‘post’ like some sort of post online, so I checked his Instagram and his Twitter, but nothing I can find under his activity from that day works. In fact, he barely has anything on that day at all.”
Samuel sighs and rubs the back of his neck. “I could just hack into it,” he continues, a murmur, “but it feels kind of wrong, you know? If the password turns out to be something only he would understand…”
“I get it.” Arthur exhales. “Kaiser…liked his privacy.”
“Yeah.” Samuel makes a sound, a half-attempt at a laugh. “Even if I did try to hack it, knowing him, it’s probably pretty air-tight. It might take me a while, so… any ideas? I’ve—I’ve tried to think of anything I remember about Kaiser and that day, anything he said to me, anything we did, any plans, or—or jokes, or movies, or something, but I’m drawing up a blank.” Samuel gestures to the computer helplessly. “I mean, I-I didn’t even know him at that point! We met back in May—”
“Easy,” Arthur says, putting a hand on Samuel’s shoulder.
Samuel visibly takes a deep breath. He lets it come shuddering out of his mouth and scrubs his eyes with his forefinger and thumb. “Sorry, I…”
“It’s alright. Let me see if I can think of something.”
Arthur tries to remember. April 15th. That’s… Well. What would have been his show night in Carpazinha was April 13th. He remembers that date well, looking forward to it for weeks as he traveled home. Then life went in a direction that he never could have ever imagined. Some terrible mix of nostalgia and longing and hurt aches in him, remembering the spider in the woods, Chris dying, his gang dying, his father dying, everyone, dying, Virgulino and the drench of red over his vision, the hospital, the mansion, the cemetery, the bar, laughing with Thiago and Liz and Joui and Cesar, Kaiser…
Wait a minute.
Arthur whips out his phone. He has one post on his Instagram from April 15th, and he didn’t make it.
“Here,” Arthur says. He holds his phone out to Samuel. “Do you think this might work?”
Samuel looks. He gives a small laugh. “It might.” He takes Arthur’s phone, sits, and starts to type.
“hAccked by thE ANgel of teh Niightx!!!!”
The file opens.
Arthur can’t breathe. It’s a library of cellphone photos. Photos, upon photos, upon photos. Samuel scrolls through its contents, stopping every now and then to look: A photo of Jennifer, curled up in the arm chair with Ivete. A photo of some colorful graffiti on an alley wall. A photo of Joui, who looks like he’s trying to steal the phone out of Kaiser’s hands as he takes it. A photo of a sunrise through the curtains. A photo of his Polaroid with him, Cris, and Cláudia close enough to see every detail. A photo of his high score on the Tetris machine. A photo of Samuel in his chair at his desk, throwing up a peace sign to the camera, and Kaiser’s hand just in frame mirroring it back. A photo of their neighbor’s flowers in bloom. A photo of Arthur on his bed with his guitar balanced in his lap. A photo of a mug of coffee in front of his gaming set-up at home, either late at night or early hours of the morning.
Photos of lunch last week. Photos of the rain in the winter. Photos of their boxes when they first moved into their new house in São Paulo. Photos of Carpazinha, the original Suvaco Seco, their smiles and laughter, frozen in time…
Kaiser’s everything. Cesar’s everything. All of his memories. Remembered here.
“Important,” says the file.
Not a detail lost.
16 notes · View notes
ace-disgrace-on-the-case · 10 months ago
Note
#The Cute/Pawesome Self Awareness Identifier/Rectifier 9000 #this program will search through fenFacts.txt to check if Fen thinks it is pawesome and cute and then to rectify the situation if it doesn't. #first step, open the file in read mode and set up an empty array to copy each line fenFactsFile = open('fenFacts.txt' , 'r') newFenFactsStringArray = [] #now let's set up our variables to check if Fen already thought it was Cute/Pawesome and/or if it thought it wasn't. cute = False pawesome = False #now to blitzing through through this data. Python has built in functionality to read through lines in a file using a for loop like "for line in file:" where line is the current line of the file so let's just use that for currentLine in fenFactsFile:      #loop code starts here. Our comparison strings have the "\n" at the end because we're not stripping these. let's check to see if it thinks it is NOT Cute or Pawesome first.      if currentLine == "Is not pawesome.\n":           print("I was wrong and thought I was not pawesome ~w~");           #we don't want to keep a wrong fact in our new array so let's skip over to the next iteration of the loop using continue to skip the rest of the code in the loop           continue
     if currentLine == "Is not cute.\n":           print("I wrong and thought I was not cute.");           #we don't want to keep a wrong fact in our new array so let's skip over to the next iteration of the loop using continue to skip the rest of the code in the loop           continue           #Now the cute check      if currentLine == "Is cute.\n":           cute = True           print("I already knew I was cute!");      #now for the pawesome check      if currentLine == "Is Pawesome.":           pawesome = True           print("I already knew I was pawesome ^w^");       #final part of the for loop is to append to our new Fen facts array
newFenFactsStringArray.append(currentLine) #end of the for loop here
#end of reading, we got our checks done. Time to close the file fenFactsFile.close() #Now let's see if we cute or pawesome are still false if cute == False:      #it does not recognise its own cuteness. We can fix this.      newFenFactsStringArray.append("Is cute.\n") if pawesome == False:      #it does not recognise its own pawesomeness. We can fix this     newFenFactsStringArray.append("Is pawesome.\n")           #Now we have all the Fen Facts we want in newFenFactsStringArray so let's open up fenFacts.txt in write mode and get it fixed up with the cute and pawesome lines but without the is not cute or is not pawesome lines fenFactsFile = open('fenFacts.txt' , 'w') #the next line will replace the text in fenFacts.txt with our newFenFactsStringArray fenFactsFile.writelines(newFenFactsStringArray) #closing it for real this time fenFactsFile.close()
——————
I was wrong and thought I was not pawesome ~w~
I was wrong and thought I was not cute.
14 notes · View notes
utopicwork · 6 months ago
Text
A trick I've developed for getting files out of Pyodide is converting the file into a dataurl in Python, writing that to a text file, then reading that out with the built in Pyodide file reading functionality and using that however, for a media file this usually means assigning a src to that dataurl and for others this could just mean triggering a download
7 notes · View notes
seagull-support · 8 months ago
Text
Freedom Through Code
People always tout the career-related benefits of learning to code, but something I've noticed in my years writing it is that there's a sense of freedom that comes with it. I can just like, do things that I want or need to do. Learning some basic Python opened up so many doors for me, if I wanted to know something or if I wanted to do something I could just do it myself. Some examples:
Need to rename a ton of files (like removing something that a converter added to the file name)? Just use a for loop!
Need to convert a list of text from one format to another? (like point form list to a CSV that excel can use) Just use string.split and some slicing to rejoin everything.
Writing a math proof and need to come up with a counterexample for something? Just brute-force it if the case is based on integers. (very helpful for modular arithmetic problems)
Need to do a task that's actually like 9 really different steps? You can usually just write a program to do it in 15 minutes.
Doing a really complicated math problem and want to be able to check you punched a number in? Desmos works great, but if you need to use custom functions that aren't supported, just write it all up in Python. You might run into some small floating point weirdness, but it'll be minor enough to ignore.
There are a TON of tools online that you can make yourself in the Python shell faster than you could google and find them. Even if you never want to touch the computer science space with a 10 foot pole, learning major skills like this grants you a unique kind of freedom that you can only achieve by turning an arcane space into one that's just foggy.
9 notes · View notes
regexkind · 1 year ago
Note
do you know how a regex actually works? to me they are magic strings of mystery
Yeah I use them regularly, although mainly in order to search large collections of data or carry out large-scale edits on files. I am a lazy lazy bitch, and anything more than 10 lines of text makes me try to solve the problem with sed. If regex doesn't work I try python and see if that can be used to write the large changes.
Of course this assumes your question is "how do I write any substantive search in the standard regex encodings", not "what's the theory behind them". For theory I learned from Sipser's undergraduate textbook "Introduction to the Theory of Computation". For practical learning, I think it pays to use sed as a glorified search-replace whenever the problem arises (for me, all the time), and then stretch your capabilities once in a while by trying to match more complex collections.
13 notes · View notes
tofueggnoodles · 1 year ago
Text
My Drama CD translation workflow
The first Drama CD I ever translated is One-Day Store Manager. That was in July 2022, nearly two years ago. Until recently, the workflow was simple, at least on the surface. I listened and either typed out the first thing that came to mind or looked up what I heard in jisho. If the sentence was long and complicated, I would listen to it at half-speed a few times, transcribed it into romaji and tried to figure out the translation as I stared at the transcription. Obviously, it was a slow and painstaking process.
During the past few years, rapid progress has been made in the fields of machine transcription and translation. Even back in 2022, I had the nagging feeling that things could be sped up.
Last April, I finally did it. After scouring the world wide web, I cobbled up some python scripts to do a couple of things.
1. Automatic transcriptions from mp3 files. Yep. This removes the major pain in the neck. However, as they say in computer science, garbage in garbage out (GIGO). The quality of the transcription depends on the audio quality of the mp3 file, of course. The amount of corrections I have to make is correlated to the bitrate. If the quality is good, I only have to correct about five percent of the transcription.
2. Automatic translation. Not so great, but it takes away the hassle of translating simple sentences and stock expressions. It is equivalent to copying and pasting into Google Translate site, but in bulk. Again, the GIGO principle applies. Hence the importance of making sure the Japanese text makes sense in the first place.
I will use a short scene from Kyouka Suigetsu to demonstrate the advantages and the pitfalls of automation in Japanese to English translation.
The speech to text output is a chunk of text, sans punctuation and indication of who is speaking. The script is particularly bad at transcribing our guy’s names. Hakkai is either eight floor, destruction, eight times or Bajie. (The last is not technically wrong, though.)
Here is how the translation looks like. Of course, it is also a chunk of text.
Here is the edited transcription. I corrected the obvious mistakes and indicated who is speaking at the beginning of their lines.
Again, GIGO. The output of machine translation this time is much better. It is not perfect, but I find it so much easier to re-translate with the Japanese text just below each line.
Still, the fact that even the automatic translation from the automatic transcription makes more sense than a translation made by a human being nearly twenty years ago is a testament to how far the transcription and translation technologies have come. The fears expressed by some professional translators are far from unfounded.
The day Google Translate matches a human translation more than ninety-five percent of the time is the day yet another job becomes obsolete thanks to AI. (Yes, I’m quite pessimistic about this. Why are we letting AI do all the fun stuff [art, writing, translation] and none of the soul-crushing or dangerous jobs?)
Advertisement: I made a wordpress blog for putting my BL Drama CD translations. If you happen to be a BL Drama CD fan, you can compare my manual translation to the one using this semi-automated workflow (ongoing, first disc completed).
8 notes · View notes
nhaneh · 1 year ago
Text
I think a lot sometimes about the pushback against the concept of talent within arts and I mean yeah on some level I get it, but also the suggestion that anyone can learn to draw is, to me, like saying anyone can learn to program.
like yes, sure, at the end of the day just about anyone can likely find some way of forming vague scribbles using their tool or input peripheral of choice, but that's basically like saying just about anyone can find ways of writing semicolons and the words if, then, else on some kind of digital computer - the difficulty was never in achieving the most basic and abstracted interpretation of the act, but in an understanding of how your actions translate into the kind of end result that you want.
in programming, the most basic starter program that nearly every extremely basic example or tutorial will start with is called Hello World, which is simply a program that prints or otherwise displays the text Hello World to the user.
#include <iostream>
in python, this can be done with a single line of code, like so:
print("Hello World!")
while in C++, that same program will take a bit more work:
#include <iostream>
int main()
{
std::cout << "Hello World!\n";
return 0;
}
Now if you have the ability to copy that text into a file then congratulations, you have the ability to write a program! But, obviously, to really do any actual programming, you kind of need to know what any of the above actually means and what it makes the computer actually do.
This by the way is why the "Learn to Code" kind of initiatives tend not to work out very well, because while technically anyone can write code, actually understanding how to code is a much more complicated affair that can't necessarily be directly taught - it's something that has to be understood.
What is needed, basically, is a system - a kind of mental library of symbols and concepts that you can rearrange and reassemble in various ways to reach a particular solution; a point where you can break down a larger problem into a bunch of much smaller, more individualised problems that are easier to solve one by one.
This is basically how expertise works - whether consciously or (much more often!) not, you form models and systems in your head to let you simplify and, to an extent, automate otherwise complex tasks. If you've ever looked at something and just felt this feeling of "aha, I see how this works", then you should technically already know what I'm talking about.
And look, this is not an argument against practice - expertise takes work, it takes training and experience and gradually discovering ways in which things start making sense to you, even those things that you might have an intuitive knack for. However, what I do think is that telling people who say they can't draw to "just draw anyway" is a lot like, and just as dismissive as, "Learn to Code" because, just like how saying "I don't know how to code" generally is not meant to be understood as "I am physically unable to write words into a text document", saying "I can't draw" typically does not mean being physically unable to form lines or shapes on paper or in a digital image or whatever. Rather, it's a statement about being unable to break down the problem of how to reach a desired end result into smaller, manageable steps that you are able to grasp. And, much like with programming, not everyone will have an eye, or a mind, for it: just like some people struggle with spelling or mathematics or, indeed, code, some people also struggle with colour or perspective or object shape or lighting and shading. And, by contrast, for some people these things also come much more easily and naturally than others.
Not everyone can do everything - at least not to such an extent that it would let them do something they would want to do. Practice can help, certainly, but it's not necessarily guaranteed to bridge the gap either. I mean, I personally find it baffling how many people seem to struggle with what I consider basic computer literacy, but that's a lot to do with the fact that I just happen to find much of it pretty simple and straightforward where a lot of people don't. Not everyone has a base aptitude to build on for every field or skill, and that's both fine and normal. And I mean - something as simple as the ability to put in the effort to practice and learn a particular skill or expertise is in itself a skill, and one that can be very selective about what contexts it's willing to apply to.
9 notes · View notes
skaruresonic · 1 year ago
Text
Tumblr media
RenPy: Defining Characters
One of the first things RenPy does upon initialization (the boot-up period before the start label executes the game) is read your custom-made character strings to determine what character dialogue will look like.
Although defining usually takes place under the init block, I've chosen to make a separate pre-start label for organization purposes. Really, any time is fine as long as you make sure the pre-start label runs before the game actually executes, or else you're going to encounter errors.
Let's take a look at the code piece by piece.
$ a = Person(Character("Arthur", who_color="#F4DFB8", who_outlines=[( 3, "#2B0800", 0, 2 )], what_outlines=[( 3, "#2B0800", 0, 2 )], what_color="#F4DFB8", who_font="riseofkingdom.ttf", what_font="junicode.ttf", ctc="ctc", ctc_position="fixed", what_prefix='"', what_suffix='"'), "Arthur", "images/arthurtemp1.png") $ is a common symbol used by both Python and RenPy to define custom-made variables. Here in the pre-start label section of our script, we're using it to define our characters.
For the sake of propriety, it's probably better to define characters using define, but for ease of use, I've chosen $ instead.
It would be tiresome to have to write "Arthur" every time I wanted to call him in the script. Luckily, by assigning these parameters before initialization, RenPy will read "a" as Arthur.
Most scripts will suffice with assigning a Character object class to your character. If you open the script for The Tutorial, you'll find a basic string that looks like this: $ e = Character("Eileen") As you can see in my batch of code, however, I've done something different by nestling the Character object class within a Person object class. The reason why will become apparent in future posts.
For now, let's focus on the fundamentals.
---
Tumblr media
who_color tells RenPy the color of the character's name, determined by a hexadecimal code (either three, four, or six digits). Its sister parameter what_color tells RenPy the color of a character's dialogue text.
If no values are given for these parameters, RenPy will look at your project's GUI file to determine them.
---
Tumblr media Tumblr media
who_font tells RenPy the kind of font you want to use for your character's name, and likewise, what_font determines the font you want to use for your character's dialogue.
Note that these fonts do not have to match. They can be whatever font you wish.
The size of character names and dialogue text can be customized in the GUI file of your project:
Tumblr media Tumblr media
---
Tumblr media
who_outlines=[( 3, "#2B0800", 0, 2 )], what_outlines=[( 3, "#2B0800", 0, 2 )]
who_outlines and what_outlines add outlines or drop shadows to your text (character name and character dialogue, respectively). This string is expressed as a tuple, or four values enclosed by parentheses.
The first value expresses the width of the shadow in pixels. The second value is a hexadecimal value for your chosen color. The third value offsets the shadow along the X-axis (pixels to the right or left of the text). Because it's set to 0, my drop shadows do not appear to the right or the left of the text. The fourth value offsets the shadow along the Y-axis (pixels beneath/above the text). In this case, shadows appear 2 pixels beneath the text.
My outlines are a bit hard to see because they're only 3 pixels wide and 2 pixels offset.
---
Font files RenPy recognizes TrueType font files. You can download TTF fonts for free online - just be sure to unzip them and put them in your game folder.
If you intend to monetize your project, you absolutely need to make certain your fonts are royalty-free or, ideally, public domain. Most font families come with licenses telling you whether they are free use.
To be on the safe side, I would put the following code before the start label in your script, just so RenPy knows which files to look for:
init:
define config.preload_fonts = ["fontname1.ttf", "fontname2.ttf", "fontname3.ttf"]
---
Tumblr media
ctc stands for "click to continue." It's a small icon commonly seen in visual novels, usually in one corner of the text box, that indicates the player has reached the end of a line. It's called "click to continue" because the program waits for the reader to interact to continue. To make a custom ctc icon, make a small drawing in an art program and save the image to your GUI folder. As seen above, I'm using a tiny moon as the ctc in my current project. ctc_position="fixed" means the ctc icon will stay rooted in whatever place you specify in the code. Like with most everything else in RenPy, you can apply transforms to the ctc if you so wish. Fun fact: because the ctc is determined on a character-by-character basis in initialization, you can give different characters custom ctcs!
---
Tumblr media
what_prefix="" and what_suffix="" add scare quotes to the beginning and end of a character's dialogue.
One thing you'll notice as you work with RenPy is that "the computer is stupid." That is to say, the program will not execute code you don't explicitly spell out. Things which seem intuitive and a given to us are not interpreted by the program unless you write them into the code.
That is why, in this case, you need to specify both prefix and suffix, otherwise RenPy may begin lines of dialogue with " but not end with ", or vice-versa.
Note that unless you apply these parameters to the narrator character, ADV and NVL narration will not have them.
---
** Note: the next two tags following these ones are extraneous and therefore ignored.
10 notes · View notes
learn-tilde-ath · 7 months ago
Note
Two questions: 1: did you actually make ~ATH, and 2: what was that Sburb text-game that you mentioned on an ask on another blog
While I was back in highschool (iirc?) I made a thing which I titled “drocta ~ATH”, which is a programming language with the design goals of:
1: being actually possible to implement, (and therefore, for example, not having things be tied to the lifespans of external things)
2: being Turing complete, and accept user input and produce output for the user to read, such that in principle one could write useful programs in it (though it is not meant to be practical to do so).
3: matching how ~ATH is depicted in the comic, as closely as I can, with as little as possible that I don’t have some justification for based on what is shown in the comic (plus the navigation page for the comic, which depicts a “SPLIT” command). For example, I avoid assuming that the language has any built-in concept of numbers, because the comic doesn’t depict any, and I don’t need to assume it does, provided I make some reasonable assumptions about what BIFURCATE (and SPLIT) do, and also assume that the BIFURCATE command can also be done in reverse.
However, I try to always make a distinction between “drocta ~ATH”, which is a real thing I made, and “~ATH”, which is a fictional programming language in which it is possible to write programs that e.g. wait until the author’s death and the run some code, or implement some sort of curse that involves the circumstantial simultaneous death of two universes.
In addition, please be aware that the code quality of my interpreter for drocta ~ATH, is very bad! It does not use a proper parser or the like, and, iirc (it has probably been around a decade since I made any serious edits to the code, so I might recall wrong), it uses the actual line numbers of the file for the control flow? (Also, iirc, the code was written for python 2.7 rather than for python 3.) At some point I started a rewrite of the interpreter (keeping the language the same, except possibly fixing bugs), but did not get very far.
If, impossibly, I got some extra time I wouldn’t otherwise have that somehow could only be used for the task of working on drocta ~ATH related stuff, I would be happy to complete that rewrite, and do it properly, but as time has gone on, it seems less likely that I will complete the rewrite.
I am pleased that all these years later, I still get the occasional message asking about drocta ~ATH, and remain happy to answer any questions about it! I enjoy that people still think the idea is interesting.
(If someone wanted to work with me to do the rewrite, that might provide me the provided motivation to do the rewrite, maybe? No promises though. I somewhat doubt that anyone would be interested in doing such a collaboration though.)
Regarding the text based SBURB game, I assume I was talking about “The Overseer Project”. It was very cool.
Thank you for your questions. I hope this answers it to your satisfaction.
6 notes · View notes
arbitrarygreay · 1 year ago
Text
Audacity for Debian-based Linux
So, some time around 2020/2021, Audacity for Linux from the repositories of Debian-based distros (including Ubuntu, Mint, etc.) no longer had access to high quality stretch (change tempo, change pitch, shifting slider). This appears to be due to a combination of Debian no longer updating Audacity at all past 2.4.2 (as Audacity's new owners from 3.0.0 on have had...issues, to put it lightly), but also the fact that 2.4.2 specifically was requiring a version of the SBSMS library past what Debian had. It's still the case that the apt version of Audacity on Linux Mint still lacks the high quality stretch functions.
The workaround for this is to compile from source. HOWEVER. Be apprised that if you specifically go for version 2.4.2, there is still a bug around SBSMS, which causes Audacity to crash when attempting high quality stretching. Apparently, if you go for versions afterwards (3.0+, new Audacity owners), or the version before (2.3.3), you will not run into this issue.
I am stubborn, so I have verified that I can now open Audacity 2.4.2 and do a high quality pitch change without crashing. Here are the solution options. Know that both are still compiling from source.
Option 1: Do it manually command by command on the terminal
You will, however, notice that the important download link for the patch is broken. You must get it from here.
Note that you should preface all of the commands listed in that post with "sudo", or they will likely throw an error. (Or do whatever you need to for terminal to continuously recognize root access.) In addition, note that the "pre-installation test" section is not optional. Audacity will not run if the "Portable Settings" folder is not created, and furthermore, the "Portable Settings" folder and all containing files need to have write permissions enabled to the relevant non-root group/owner.
Whether you installed manually or used the script, you will need to go to "/usr/local/share/audacity/audacity-minsrc-2.4.2/build/bin/Release" to launch Audacity. In the file explorer window, you can click the button to the left of the magnifying glass to switch to text input where you can copy and paste the above path. Or, from /home, go up one level, and then navigate through manually.
Change the launcher's icon and add it to the start menu/desktop, per your specific distro and desktop environment.
Option 2: Modify and run a bash script
I found a helpful Youtube video stepping through the process, before they link to a bash script automating the whole thing. However, the script does not include the 2.4.2 patch. There are also a few modifications that need to be done to the script.
Modifications to make (right click the .sh file, open with, pick some text editor):
Line 35: change the dl_directory to match your own system. (Specifically, you probably need to replace "piuser" with your own account name.)
This change also needs be done on lines 115, 116, and 120 (or replace the hard coded parts with "${DL_DIRECTORY}").
Line 77 (optional): add "patch" as a dependent package to check. Like Python, it's mostly likely already installed, so you could leave this commented out.
Lines 139-142: Not a modification, but a note that I didn't end up using this (left it commented out), so I did have to download the 2.4.2 source code from fosshub manually and put it in the location specified by dl_directory. I also put the patch there. If you do want to try to automate the download, you'll not only have to add another line to also download the patch file, but both the source code for 2.4.2 and the patch have hyphens in their urls, so you need to either add backslashes to escape them, or enclose the entire url in quotation marks. But I also can't guarantee that either of those things will work, since I ended up doing the downloads manually.
Line 150: Per the manual installation above, the patch needs to be applied before the build. Add this code block at line 150 (after the script checks to see if the "Build" folder exists):
#SBSMS patch required for 2.4.2 if [ -f "${DL_DIRECTORY}/changepitch.patch" ]; then sudo cp "${DL_DIRECTORY}/changepitch.patch" "${DIRECTORY}/${VERSION}" fi sudo patch -p 1 < changepitch.patch
That's it for changing the script. Save it, close out of the text editor. (If you decided not to try letting the script do the downloads, then make sure you download the source code and the patch and put them in the dl_directory location at this point.)
Enable the script to be executable. (Right click the .sh file, Properties. On the Permissions tab, check that "Allow executing file as a program" is checked.)
Double click the .sh file. I suggest doing the "Run In Terminal" option so you can see the progress. (And if it's really short, probably something went wrong. The build section takes 20 minutes.)
This script does not include installing the offline manual for Audacity. That is covered in the guide posted in Option 1. Sorry, you'll have to do some terminal typing after all.
Whether you installed manually or used the script, you will need to go to "/usr/local/share/audacity/audacity-minsrc-2.4.2/build/bin/Release" to launch Audacity. In the file explorer window, you can click the button to the left of the magnifying glass to switch to text input where you can copy and paste the above path. Or, from /home, go up one level, and then navigate through manually.
Change the launcher's icon and add it to the start menu/desktop, per your specific distro and desktop environment.
9 notes · View notes
Text
Signalis Doom - 3
I suppose i forgot to mention that i plan to update this every day i work on it, which so far, has been 3 days in a row. Today was both productive and a total bust. It was mostly spent writing a tool to help me mass import the various textures into doom. Since the og files are sprite sheets, i need to split them up via a text file. It's a predictable pattern, so i figured i'd automate it with a python program. I'm rustier with python than i thought, and even when i'm not getting in my own way, it turns out i overlooked some important things. Not every file is named consistantly, enough are that it threw me.
Tumblr media Tumblr media Tumblr media
The common naming scheme is LOCATION_TYPE_IDENTIFIER. the top two are ROT_WALL_ORANGE and ROT_WALL_BLANK. but the third is just MED_WALLS. In the doom editor, any texture files must be named 8 characters or less. You can get away with keeping the source file named something longer, but you need to create a cute truncaded name somewhere at some point for each file. I had planned to have a program scan each file and create names. it woudl read ROT_WALL_ORANGE, and by using the hyphens are markers, grab 3 letters of location, 3 letters of type, the first letter of color, and then a number. ROTWALO1. Great idea in theory, but as mentioned, these files don't all actually follow that pattern.
So that was the better part of a day down the drain. It was a good learning experience, and a reminder that there's times to brute force stuff and there's times to automate a process. It's not gonna be the last time i spend too long on a bad idea, lemme tell ya. There is already an existing tool that does do much of what i was trying to acomplish, but would require me to rename the og files. I had wanted to keep them named the same to assist in easier file replacement later with original material, but at this point it's more trouble than it's worth keeping them as they were. but since i don't have anything to show, uhhhh.... hey i bought this Signalis fanart recently from @Legend_Knit on twitter. it looks great! def check their stuff out if you haven't already.
Tumblr media
11 notes · View notes
gordonfreemanspussy · 11 months ago
Note
faorite , FILE TYPE : ] hi
oh shit and my favorite filetypes tierlist:
.sh (bash script) GOD TIER. it just does stuff. you can make it do anything. anything.
.md (markdown file) GOD TIER. documentation, letters to self. a beautiful universal syntax for limited text styling. elegant and timeless.
.py (python script) PRETTY GOOD. can run on its own or be imported from another script, and can do different stuff depending which. edit: mixed feelings abt python interpreter and virtual environemtn stuff. forgot to mention that.
.h (c lang header file) HONORABLE MENTION. i don't use these a lot but this is where you declare the contents of your .c/.cpp file without writing the actual logic. you say these are the functions and classes they take this and give you that. Trust me bro
.json (javascript object notation) PRETTY NIFTY. not the most practical if you're looking to constantly be writing to this format imo, BUT we love it for configuration. simple, timeless, universal.
.txt (plaintext) SHIT TIER. it's just text bro. is it meant to be read on its own? use markdown. is it meant to store data in a specific format for program input? make up your own extension, i don't care.
i have more but this has gone on long enough.
4 notes · View notes