Blog Articles

<

1 / 2

>
See Tags

2023: My Most Transformative Year

You know, like everybody else in this world, I've always planning some revolutionary things to do next year. But like everybody else in this world, I've never really done any revolutionary things in each year so..... ![Foto LKS](https://drive.google.com/uc?export=view&id=1p4_ZdBav70drrMT2QMIqgNk33Ua3i8NR) As we bid farewell to 2023 and step into the unknown corridors of 2024, it's only fitting to take a moment to reflect on the roller coaster ride that was the past year. For me, 2023 was a year of firsts, failures, friendships, and a whole lot of learning. Join me as I navigate through the highlights of my journey. One of the most significant milestones of 2023 was diving headfirst into the realm of entrepreneurship. So me and my buddy Beni decided to dip our toes into the whole entrepreneurship thing. Long story short, we started a project that actually brought in some cash. Not bad for a couple of rookies, huh? Learning became a constant companion throughout the year. From honing technical skills to exploring new areas of interest, 2023 was a chapter of intellectual growth for me. 2023 was like a crash course in everything. I'm talking about leveling up my skills, exploring random stuff, and basically turning myself into a mini expert in, like, 100 different things. Learning was the name of the game, and damn, it was a wild ride. The tapestry of life is woven with the threads of relationships, and 2023 introduced me to an array of new friends. Met some cool-ass people along the way. New friends, new vibes. Whether we clicked over some weird hobby or just shared a common hatred for Mondays, these connections added some serious flavor to my year. Decided my personal website needed a glow-up. Remade my personal website like I was on a mission. It's not just about looking good (although that's a bonus), but about showing off the real me—projects, wins(if I ever win anything), and the whole shebang. So, 2023, you crazy son of a gun. Thanks for the ups, the downs, and the messy in-betweens. Each curveball taught me something, and I'm heading into 2024 with some battle scars and a big ol' grin. Here's to more adventures, more growth, and less boring shit. Cheers to the next chapter! 🚀✌️ "2024 gon be our year fr" "Bismillah menang LKS"

Trithemius Cipher in Rust

Hey fellas! Ever heard of "Trithemius Cipher"? You might be wandering, what the heck is a trithemius? Well actually, Trithemius or known as Johannes Trithemius is a german polymath that created this cipher. The Trithemius Cipher is one of the polyalphabetic codes designed to be easier to use. Today, let's embark on a thrilling journey into the world of cryptography with Rust. Our destination? The Trithemius Cipher – a historic encryption technique that adds a dash of mystery to our codes. Our weapon of choice for this cryptographic escapade is Rust, a language known for its speed, safety, and expressiveness. Our code is a humble blend of I/O operations, string manipulation, and a pinch of modular arithmetic. First, you have to install [Rust](https://rust-lang.org/), Then, you create a new project with the cargo in whatever folder you desire. ```bash cargo new trithemius_cipher ``` Now that's done, you can copy (or type if you're not lazy enough) the code below: ```rust use std::io; fn trithemius_cipher(message: &str, shift: u8) -> String { let message_chars: Vec<char> = message.chars().collect(); let mut result: String = String::new(); for &c in message_chars.iter() { if c.is_alphabetic() { let base: u8 = if c.is_lowercase() { 'a' as u8 } else { 'A' as u8 }; let encrypted_char: char = ((((c as u8 - base) + shift) % 26) + base) as char; result.push(encrypted_char); } else { result.push(c); } } result } ``` Wowowowow, wait a second, what the heck was that just now? The Trithemius Cipher is a polyalphabetic substitution cipher, a mouthful that basically means each letter can be replaced by multiple different letters (it is as simple as that). In our Rust code, this is achieved through a clever combination of modular arithmetic and character manipulation. ```rust let base: u8 = if c.is_lowercase() { 'a' as u8 } else { 'A' as u8 }; let encrypted_char: char = ((((c as u8 - base) + shift) % 26) + base) as char; ``` Breaking it down, each alphabetic character takes a journey from its original position in the alphabet to a new destination based on the user-provided shift value. The modular arithmetic ensures that the journey wraps around the alphabet seamlessly. "But why Rust?" you may ask. Rust, with its emphasis on performance, memory safety, and zero-cost abstractions, proves to be an ideal companion in this case. The code gracefully handles user inputs, ensuring a smooth interaction with the cipher. Now to run the code, you'll have to do a bit of command-line interaction. Run this command in the root directory where the `Cargo.toml` are placed at ```bash cargo build ``` Now you just have to run the .exe file in the debug folder at the target folder ```bash .\target\debug\trithemius_cipher ``` That's it! Now you can encrypt a message with the Trithemius Cipher method. But hold on, how do you decrypt one? You just have to reverse the method. ```rust fn trithemius_decipher(message: &str, shift: u8) -> String { let message_chars: Vec<char> = message.chars().collect(); let mut result: String = String::new(); for &c in message_chars.iter() { if c.is_alphabetic() { let base: u8 = if c.is_lowercase() { 'a' as u8 } else { 'A' as u8 }; let decrypted_char: char = ((((c as u8 - base) + 26 - shift) % 26) + base) as char; result.push(decrypted_char); } else { result.push(c); } } result } ``` That's it! We're done, now you can use these methods on your code. Like for example here if you want to decrypt a greeting message to your friend (not sure why'd you do that tho), you can just make a main function and use the methods above: ```rust fn main() { let encrypted_message: String = trithemius_cipher("What's good buddy?", 3); println!("Encrypted message: {}", encrypted_message); } ```

Creating a basic HTTP server with Go

Go (or Golang) is a powerful and efficient programming language that excels in building scalable and concurrent applications. In this occasion, we'll walk through the process of creating a simple HTTP server using Go. By the end of this guide, you'll have a basic understanding of how to handle HTTP requests and responses. Today, I'm going to share what I've learnt so far about building an HTTP server wiht Go. ## Prerequisites Before we begin, make sure you have Go installed on your machine. You can download it from the official [Go website](https://go.dev/doc/install). ## Project Setup ```bash mkdir go-http-server cd go-http-server ``` Now, create a file named main.go for our Go code. ```go // main.go package main import ( "fmt" "net/http" ) func main() { // Your HTTP server code will go here } ``` ## Handling an HTTP Request To handle HTTP requests, we'll use the `http `package provided by Go. Let's create a simple HTTP handler function that responds to incoming requests. ```go import ( "errors" "fmt" "io" "net/http" "os" ) func get(w http.ResponseWriter, r *http.Request) { fmt.Printf("Responding to GET / /\n") io.WriteString(w, "Hello World!\n") } ``` Now, let's register this handler function in our HTTP server ```go func main() { http.HandleFunc("/", get) err := http.ListenAndServe(":8080", nil) if errors.Is(err, http.ErrServerClosed) { fmt.Printf("Server closed\n") } else if err != nil { fmt.Printf("Error starting server: %s\n", err) os.Exit(1) } } ``` ## Run Your HTTP Server Save the changes applied to main.go, and you can now run your HTTP server. ```bash go run main.go ``` Visit http://localhost:8080 in your web browser, and you should see the message "Hello World!". You can also use the curl command in cmd and you'll also get the same response ```bash curl http://localhost:8080/ ``` And that's it! You have your first HTTP server built with Go. You can expand it a bit further by using `mux` to multiplex a server and http.Handler implementation by `net/http` package, which you can use for a case like this. ```go package main import ( "encoding/json" "errors" "fmt" "math/rand" "net/http" "os" ) type User struct { ID string `json:"id"` Name string `json:"name"` } var users map[string]User var letterRunes = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") func generateId(n int) string { b := make([]rune, n) for i := range b { b[i] = letterRunes[rand.Intn(len(letterRunes))] } return string(b) } func getUsers(w http.ResponseWriter, r *http.Request) { fmt.Printf("Responding to GET /\n") usersList := make([]User, 0, len(users)) for _, user := range users { usersList = append(usersList, user) } res, err := json.Marshal(usersList) if err != nil { http.Error(w, "Internal Server Error", http.StatusInternalServerError) return } w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusOK) w.Write(res) } func createUser(w http.ResponseWriter, r *http.Request) { fmt.Printf("Responding to POST /") var newUser User decoder := json.NewDecoder(r.Body) err := decoder.Decode(&newUser) if err != nil { http.Error(w, "Bad Request", http.StatusBadRequest) return } newUser.ID = generateId(12) users[newUser.ID] = newUser res, err := json.Marshal(newUser) if err != nil { http.Error(w, "Internal Server Error", http.StatusInternalServerError) return } w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusOK) w.Write(res) } func main() { users = make(map[string]User) mux := http.NewServeMux() mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { switch r.Method { case http.MethodGet: getUsers(w, r) case http.MethodPost: createUser(w, r) } }) err := http.ListenAndServe(":8080", mux) if errors.Is(err, http.ErrServerClosed) { fmt.Printf("Server closed") } else if err != nil { fmt.Printf("Error starting server: %s\n", err) os.Exit(1) } } ```

Google Developer Groups Surabaya: Developer Festival 2023

![GDG Surabaya Devfest 2023](https://drive.google.com/uc?export=view&id=1c89rcrXti_M3dUnHkIQIHnFR7e5MlWwc) DevFest Surabaya 2023 at the Yarra Ballroom was off the charts! Hanging out with Kusindra Aji Rabbany, Muhammad Fadhil Kholaf, Arsyad Ali Mahardika, Nico Lee N.H, Sulthan Budiman, and Muhammad Zuhair Zuhdi made the whole thing a blast. And guess what? Got to meet some cool SMK Telkom Malang alumni - Haidar Zamzam, Ronald Dimas Yuwandika, and Irfan Hakim. Small world, eh? The sessions were mind-blowing. We dived into some next-level projects, like Machine Learning and generative AI stuff. Seeing those concepts in action was like watching magics unfold. Prototyping AI in MakerSuit? That's some wild creativity meets tech genius thing right there. And oh, 'KerasNLP models' – I thought I'd get lost, but the speakers made it so damn clear. Natural Language Processing got a whole lot more interesting after that. I'm all hyped to play around with language and tech in my future projects. The session on making apps for different devices and screens with Kotlin and Compose Multiplatform? My mind are officially blown. Kotlin's versatility is no joke. I can't wait to dig deeper and see how I can use it in my own projects. But you know what made it even more awesome? The vibe. The whole place were buzzed with passion and excitement. Everyone was sharing ideas, working together – it was like a tech party, and I just happen to like tech a lot. As the day wrapped up, I felt pumped up and ready to rock. DevFest Surabaya 2023 didn't just level up my tech game; it sparked a fire in me. I'm taking all this cool stuff back to my projects, and I'm stoked to see how these innovations will shape my tech journey. Big shoutout to Google Developer Groups for throwing a fest that's not just about coding but about pushing boundaries and having a blast while doing it!

Vacation Journal: A Trip to Modangan Beach

The class graduation vacation on June 10, 2023, was a memorable experience as my classmates and I embarked on a trip to Modangan Beach in Malang, Indonesia. With its breathtaking beauty, the beach felt like a hidden paradise due to its relative obscurity. Our journey began at 5 a.m. when we gathered in Sawojajar, and around 5:30 a.m., we set off from Sawojajar towards Modangan Beach, which was approximately 75 kilometers away. We traveled by motorcycles, and the journey took about 4 to 5 hours. However, midway through the trip, two of our friends had a serious accident, which required us to halt temporarily and ensure they weren't severely injured. Thankfully, nobody was seriously hurt. Afterward, we finally arrived at the beach, and I was truly amazed by the breathtaking scenery it offered. The sky was a vibrant blue, and the sound of gentle waves, along with the clean and peaceful environment, made the beach truly feel like paradise. The views were phenomenal, and I took several photos to capture the moment. ![Pantai](https://res.cloudinary.com/dyw30vzvl/image/upload/v1688141468/IMG_20230610_095816_ywcizj.jpg) ![Pantai 2](https://res.cloudinary.com/dyw30vzvl/image/upload/v1688214376/blog/1688214363550-798.jpg) On our way back, we stopped by our friend Andi's house, which was conveniently close by, to rest for about 2 hours before continuing our journey home. During the trip, one of my friends and I accidentally got separated from the group and ended up getting lost for a while before eventually reuniting with the others. We finally arrived back in Sawojajar around 6 p.m. It was an exciting experience and a perfect way to conclude our best class farewell. This vacation created lasting memories and allowed us to bond even more closely. We feel grateful for the time we spent together at the stunning Modangan Beach. The entire trip enriched our experiences and created memories that will be cherished for a lifetime. It provided us with an opportunity to have fun, get to know each other better, and form unforgettable bonds.