Skip to content

Instantly share code, notes, and snippets.

View Samet195's full-sized avatar

Samet Arık Samet195

View GitHub Profile
use std::fmt::Display;
use std::io::{stdin, stdout, Stdin, Write};
pub trait Input {
fn input(&self, prompt: impl Display) -> Box<str> {
let mut buffer = String::new();
stdout().write(prompt.to_string().as_bytes()).unwrap();
stdout().flush().unwrap();
stdin().read_line(&mut buffer).unwrap();
@Samet195
Samet195 / struct_lib.rs
Last active September 22, 2023 18:08
Java like OOP Programming in Rust
use std::fmt::Display;
use std::io::{stdin, stdout, Write};
struct Library;
impl Library {
pub fn main() {
Self.greet(Self::input("Who are you?: "));
}
fn greet(&self, name: impl Display) {
@Samet195
Samet195 / input.rs
Last active September 22, 2023 18:01
Python's `input()` fn Implementation in Rust
use std::fmt::Display;
use std::io::{stdin, stdout, Write};
pub fn input(prompt: impl Display) -> Box<str> {
let mut buffer = String::new();
stdout().write(prompt.to_string().as_bytes()).unwrap();
stdout().flush().unwrap();
stdin().read_line(&mut buffer).unwrap();
@Samet195
Samet195 / Functional_Programming_like_OOP.py
Last active July 18, 2021 07:54
Functional Programming like OOP
#!/usr/bin/env python3
# -*- coding:UTF-8 -*-
"""
Functional Programming like OOP.
"""
import sys
@Samet195
Samet195 / Template.py
Last active July 17, 2021 08:41
Python Templates
#!/usr/bin/env python3
# -*- coding:UTF-8 -*-
"""
TODO: Documetation to here.
"""
from time import sleep
import json, sys, os
@Samet195
Samet195 / 1.groupby.py
Last active July 17, 2021 08:54
Python Groupby Example
#!/usr/bin/env python3
# -*- coding:UTF-8 -*-
"""
TODO: Documetation to here.
"""
import itertools, json, sys
@Samet195
Samet195 / TkInter-Template.py
Last active June 12, 2022 16:23
Python TkInter Object Oriented Template
#!/usr/bin/env python3
# -*- coding:UTF-8 -*-
"""
TODO: Documentation to here.
"""
from tkinter import *
from ui import Ui
import json, sys, os
@Samet195
Samet195 / shell.py
Last active January 20, 2021 21:14
Access system shell with this Python code. Warning: You can't change directory.
while True: __import__("os").system(input(__import__("os").getcwd() + "> "))