crdpa's recent activity

  1. Comment on Where did the trend of disabling Javascript in one's browser originate from? in ~comp

    crdpa
    Link Parent
    Isn't Firefox on iOS just a frontend to safari? I heard elsewhere that they only allow their engine.

    Isn't Firefox on iOS just a frontend to safari? I heard elsewhere that they only allow their engine.

    1 vote
  2. Comment on You're probably not using the web's best browser (Vivaldi) in ~tech

    crdpa
    Link
    Isn't Vivaldi using the Chrome engine (Blink i think)? No way i'm going to change from Mozilla. It is still a way to push the monopoly of Chrome.

    Isn't Vivaldi using the Chrome engine (Blink i think)? No way i'm going to change from Mozilla.

    It is still a way to push the monopoly of Chrome.

    42 votes
  3. Comment on Fortnightly Programming Q&A Thread in ~comp

    crdpa
    Link
    I'm making a server in Go for my new page. Something simple. There will be three sections. Index, blog and resume. Here is the code: server.go package main import ( "fmt"...

    I'm making a server in Go for my new page. Something simple.

    There will be three sections. Index, blog and resume. Here is the code:

    • server.go
    package main
    
    import (
    	"fmt"
    	"github.com/crdpa/crdpa.net/routes"
    	"log"
    	"net/http"
    )
    
    func main() {
    	routes.RouteHandler()
    
    	fmt.Printf("Starting server at port 8000\n")
    	if err := http.ListenAndServe(":8000", nil); err != nil {
    		log.Fatal(err)
    	}
    }
    
    • routes.go
    package routes
    
    import (
    	//    "github.com/crdpa/crdpa.net/"
    	"html/template"
    	"net/http"
    )
    
    var temp = template.Must(template.ParseGlob("templates/*.html"))
    
    func index(w http.ResponseWriter, r *http.Request) {
    	temp.ExecuteTemplate(w, "Index", nil)
    }
    
    func blog(w http.ResponseWriter, r *http.Request) {
    	temp.ExecuteTemplate(w, "Blog", nil)
    }
    
    func resume(w http.ResponseWriter, r *http.Request) {
    	temp.ExecuteTemplate(w, "Resume", nil)
    }
    
    func RouteHandler() {
    	http.HandleFunc("/", index)
    	http.HandleFunc("/blog", blog)
    	http.HandleFunc("/resume", resume)
    }
    

    I want the site to have two languages. Portuguese and English.

    So the urls would be /en/blog /en/resume /en/ for english and without /en for portuguese.

    It's just a matter of creating three more functions and doing:

    http.HandleFunc("en/", index_en)
    http.HandleFunc("en/blog", blog_en)
    http.HandleFunc("en/resume", resume_en)
    

    or is there a better way?

    And those functions "index", "blog" and "resume" are too similar, it just changes one word. Is there a better way of coding this?

    2 votes
  4. Comment on What helps keep you off social media? in ~talk

    crdpa
    Link Parent
    I always thought that those things wouldn't help because i can easily unblock. But i was using a toxic bbs in the past and had enough. Blocked on my router so it is a little more work to unblock,...

    I always thought that those things wouldn't help because i can easily unblock.

    But i was using a toxic bbs in the past and had enough. Blocked on my router so it is a little more work to unblock, but still easy.

    I never even tried to visit again. Even when i'm out somewhere and it is unblocked.

    There is some psychology in this...

    2 votes
  5. Comment on What helps keep you off social media? in ~talk

    crdpa
    Link
    I have a bunch of social media accounts, but i don't use any social aspects. Goodreads where i register the books i've read and letterboxd for movies. Facebook i use to look for new and cheaper...

    I have a bunch of social media accounts, but i don't use any social aspects.

    Goodreads where i register the books i've read and letterboxd for movies.

    Facebook i use to look for new and cheaper places to rent and sometimes to sell things locally.

    I guess i just stopped caring as i got older.

    These days i tried Mastodon and two days later i deleted it. I am thinking of joining IRC again since they moved to LiberaChat because of the Freenode fiasco, but i'm pretty sure i will join two or three days and stop.

    Even here i forget to visit.

    Reddit is the only one i visit daily still, but i'm in like 4 subreddits that i care. It still sucks time and energy when i get sucked into useless debates. Just fell into one today with a person shitting on Linux because of fragmentation (again). Sometimes i fall for that trap.

    Not saying that he is wrong, just that it is a waste of time.

    Also, thanks for the flipside. Here in Brazil we have something similar too (Meio).

    2 votes
  6. Comment on What programming/technical projects have you been working on? in ~comp

    crdpa
    Link
    Like i said recently in the previous thread, i just finished writing a program that stores the songs, artists, albums and number of plays in a SQLite database. Link:...

    Like i said recently in the previous thread, i just finished writing a program that stores the songs, artists, albums and number of plays in a SQLite database.

    Link: https://github.com/crdpa/cmusicbox

    With the help of @Deimos i fixed some issues i had with the database structure and hopefully it is better now.

    I'm planning on changing 'number of plays' to 'date' so i can record when the songs where played. It works the same way as "plays", i just have to count how many records of "date" a particular song or artist has.

    Baby steps, because i'm really new to all this and i still need to figure out how to do it.

    2 votes
  7. Comment on How should I make my personal website? in ~tech

    crdpa
    (edited )
    Link
    I'm also from Brazil and i host my website on github. Here it is: https://crdpa.net I just write my pages with markdown and convert using a custom bash script i wrote and just push to the repo....

    I'm also from Brazil and i host my website on github. Here it is: https://crdpa.net

    I just write my pages with markdown and convert using a custom bash script i wrote and just push to the repo.

    The only cost is Google Domains.

    2 votes
  8. Comment on What programming/technical projects have you been working on? in ~comp

    crdpa
    (edited )
    Link Parent
    Thanks a lot! That is really helpful. I'll change right now. I think i'm going to do an udemy or another similar course on databases. I noticed i don't know a single thing about it. I messed with...

    Thanks a lot! That is really helpful.

    I'll change right now.

    I think i'm going to do an udemy or another similar course on databases. I noticed i don't know a single thing about it. I messed with PostgreSQL in one course and the syntax is really similar, but it was a little superficial. It didn´t teach anything about how databases work, just insert, replace, etc.

    How would i go to print the top 10 most played artists in this setup since plays are only on tracks?

    SELECT artist_name, plays FROM tracks GROUP BY artist_name ORDER BY plays DESC LIMIT 10
    

    This is not working. An artist has 9 plays with 3 different albums, but the result shows just 6 from the most played album.

    Update: using SUM(plays) worked. Is this correct?

    3 votes
  9. Comment on What programming/technical projects have you been working on? in ~comp

    crdpa
    Link
    Just finished writing a program that stores the songs, artists and albums played (and number of plays) in a SQLite database. Here it is: https://github.com/crdpa/cmusicbox I made it to use with...

    Just finished writing a program that stores the songs, artists and albums played (and number of plays) in a SQLite database.

    Here it is: https://github.com/crdpa/cmusicbox

    I made it to use with cmus, but it can work with any player that outputs song title, artist name and album title.

    cmusicbox-print prints a top 10 artists and a top 10 songs tables.

    It is like a poor man's personal last.fm.

    I'm planning to output the results weekly to a html page and upload to my website. Since it is a static page hosted on github, i will probably do it by hand.

    Any criticisms are welcome. I just learned how to create databases so it's probably messy.

    3 votes
  10. Comment on Is anyone else here trying to understand or deal with how 'time flies by' with age? in ~talk

    crdpa
    Link Parent
    This is fear of death. It has many forms. The Denial of Death (Ernest Becker) is a good book on the subject.

    My point was that I relish in my human existence and want to prolong that experience as much as possible.

    This is fear of death. It has many forms.

    The Denial of Death (Ernest Becker) is a good book on the subject.

  11. Comment on Hi, how are you? Mental health support and discussion thread (June 2021) in ~talk

    crdpa
    Link Parent
    Thanks for the kind words. I think i have an ebook about Nonviolent Communication. I'll take a look, because i'm having a hard time trying to think in a way to tell her.

    Thanks for the kind words.

    I think i have an ebook about Nonviolent Communication. I'll take a look, because i'm having a hard time trying to think in a way to tell her.

    6 votes
  12. Comment on Hi, how are you? Mental health support and discussion thread (June 2021) in ~talk

    crdpa
    Link
    I'm happy and sad at the same time. My girlfriend and I both have problems. Mine is with alcohol, hers is with obesity/food. We are 4 and a half years together now. I am finally working on my...

    I'm happy and sad at the same time.

    My girlfriend and I both have problems. Mine is with alcohol, hers is with obesity/food.

    We are 4 and a half years together now. I am finally working on my problem and found a psychologist who specializes in naltrexone and the Sinclair Method. It's working great. Days pass by that i completely forget about beer. I have a 12 pack at home that i forgot about it. It's been sitting there for 15 days now. I still binge here and there, but it is going down.

    I've gone from 32 drinks per week to 8 last week and just 3 the week before last. I lost weight (but i didn't need to) and am feeling great.

    This is the happy part.

    The sad part is that my SO seems to be getting worse. She is clearly gaining weight and just don't talk about it. We talked about it in the past, her doctor said she was in danger of becoming pre-diabetic (she is only 26), but nothing changed.

    Last time we talked about it (more than a year ago. Can't remember) she said she accepts herself and that is a big part of facing the problem, but i think that acceptance is the step she wants to stay.

    I love her, we are great together, but i don't see myself being happy with this.

    I tried to look past it. I've been ignoring it. I'm not talking about it, just keeping it inside, but i'm slowly becoming unhappy.

    We still have sex, but it is coming to a point that i don't want anymore.

    I should have seen this. She was always sedentary and already had a weight problem when we started dating, but i overlooked it because we are good together. She made me a better person and it pains me to contemplate a future without her.

    I don't want a kid in an environment where obesity is normalized (almost her entire family is obese) the same way i don't want alcoholism near my home.

    The other problem is that we are both working in different cities (4h distance) with no hope of changing. I am the only one trying to change carrer (i want to become a developer) and looking for opportunities were she lives.

    I wish life had a rewind button...

    13 votes
  13. Comment on Tab viewer/organizer? in ~tech

    crdpa
    Link Parent
    Those colorful tabs are cool indeed. The only thing i miss from TST is left click > send tab to device so i can send the tab to my phone, but i can do that by clicking on the account icon in the...

    Those colorful tabs are cool indeed.

    The only thing i miss from TST is left click > send tab to device so i can send the tab to my phone, but i can do that by clicking on the account icon in the address bar.

    1 vote
  14. Comment on Tab viewer/organizer? in ~tech

    crdpa
    Link
    Just found Sidebery and i'm liking it more than Tree Style Tabs.

    Just found Sidebery and i'm liking it more than Tree Style Tabs.

    1 vote
  15. Comment on Tab viewer/organizer? in ~tech

    crdpa
    (edited )
    Link Parent
    That Tree Tabs is really cool, but it doesn't have an update in two years. My fear is getting used to it and breaking in the future. Is it still being developed? Tree Style Tabs is still going....

    That Tree Tabs is really cool, but it doesn't have an update in two years. My fear is getting used to it and breaking in the future. Is it still being developed? Tree Style Tabs is still going.

    EDIT: Just found Sidebery and i'm liking it more than Tree Style Tabs.

    2 votes
  16. Comment on What's something that took you a long time to like? in ~talk

    crdpa
    Link Parent
    I too started late and read a lot. These days i'm reading less and less. This year i wasn"t able to finish a book yet. I drop it after a week of not reading... It is the f*cking internet/netflix.

    I too started late and read a lot. These days i'm reading less and less. This year i wasn"t able to finish a book yet. I drop it after a week of not reading...

    It is the f*cking internet/netflix.

    4 votes
  17. Comment on Share your linux desktop/setup in ~comp

    crdpa
    Link Parent
    I'm back to cmus actually. Mpd+ncmpcpp is cool, but i think it is too overkill for my needs.

    I'm back to cmus actually.

    Mpd+ncmpcpp is cool, but i think it is too overkill for my needs.

  18. Comment on What are you reading these days? in ~books

    crdpa
    Link
    I was not reading anything lately. Every book i start, i drop after a week of not reading. Don´t know what is happening. I think i didn´t read anything this year. Decided to get back with a...

    I was not reading anything lately. Every book i start, i drop after a week of not reading. Don´t know what is happening. I think i didn´t read anything this year.

    Decided to get back with a smaller book and am reading "Intermitências da Morte" (Death With Interruptions) by José Saramago. Going well so far.

    1 vote
  19. Comment on Share your linux desktop/setup in ~comp

  20. Comment on Share your linux desktop/setup in ~comp

    crdpa
    (edited )
    Link Parent
    Just made something quickly here. choice=$(printf "all\nartists\nalbums\nplaylists" | wofi -d -p "Music:") playlists() { selection=$(mpc lsplaylists | wofi -d -p "Playlist:") [ -n "$selection" ]...

    Just made something quickly here.

    choice=$(printf "all\nartists\nalbums\nplaylists" | wofi -d -p "Music:")
    
    playlists() {
        selection=$(mpc lsplaylists | wofi -d -p "Playlist:")
        [ -n "$selection" ] && mpc -q clear && \
        mpc -q load "$selection" && mpc -q play
    }
    
    artists() {
        selection=$(mpc list artist | wofi -d -p "Artist:")
        [ -n "$selection" ] && mpc -q clear && \
        mpc -q findadd artist "$selection" && mpc -q random off && mpc -q play
    }
    
    albums() {
        selection=$(mpc list album | wofi -d -p "Album:")
        [ -n "$selection" ] && mpc -q clear && \
        mpc -q findadd album "$selection" && mpc -q random off && mpc -q play
    }
    
    all() {
        mpc -q clear
        mpc -q random on
        mpc -q repeat on
        mpc ls | mpc add
        mpc play
    }
    
    case "$choice" in
        all)
            all
            ;;
        playlists)
            playlists
            ;;
        artists)
            artists
            ;;
        albums)
            albums
            ;;
    esac
    
    5 votes