Skip to content

Instantly share code, notes, and snippets.

View oldtune's full-sized avatar
🤪
Quack Quack!

Quack Quack oldtune

🤪
Quack Quack!
View GitHub Profile
@oldtune
oldtune / Microsoft.PowerShell_profile.ps1
Created June 10, 2024 09:16
Powershell + Starship duplicate tab using CWD (Current working directory)
function Invoke-Starship-PreCommand {
$loc = $executionContext.SessionState.Path.CurrentLocation;
$prompt = "$([char]27)]9;12$([char]7)"
if ($loc.Provider.Name -eq "FileSystem")
{
$prompt += "$([char]27)]9;9;`"$($loc.ProviderPath)`"$([char]27)\"
}
$host.ui.Write($prompt)
}
@oldtune
oldtune / gist:e76cab4078747e58ab4a698a2904ffaa
Last active February 22, 2024 14:05
Lightsail init script for my stuff
#!/bin/bash
sudo su
sudo apt-get update -y && sudo apt-get upgrade -y
sudo apt-get install neovim -y
sudo apt-get install wireguard-tools -y
cd /etc/wireguard
touch wg0.conf
wg genkey > privatekey
wg pubkey < privatekey > publickey
@oldtune
oldtune / Luv
Created June 19, 2023 04:43
LUV
Luv Cún!!!
@oldtune
oldtune / main.rs
Created June 15, 2023 08:29
crawler main.rs 3
async fn main() -> anyhow::Result<()> {
let http_client = build_http_client()?;
//we are searching for the word "access" here.
let html = http_client
.get("http://tratu.coviet.vn/hoc-tieng-anh/tu-dien/lac-viet/A-V/access.html")
.send()
.await?
.text_with_charset("utf-8")
.await?;
@oldtune
oldtune / main.rs
Created June 15, 2023 08:27
crawler main.rs 2
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let http_client = build_http_client()?;
//we are searching for the word "access" here.
let html = http_client.get("http://tratu.coviet.vn/hoc-tieng-anh/tu-dien/lac-viet/A-V/access.html")
.send().await?
.text_with_charset("utf-8").await?;
dbg!(html);
@oldtune
oldtune / main.rs
Created June 15, 2023 08:26
crawler main.rs
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let http_client = build_http_client()?;
// Note that the code is incomplete here
Ok(())
}
fn build_http_client() -> reqwest::Result<reqwest::Client> {
let client_builder = reqwest::ClientBuilder::new().gzip(true);
let client = client_builder.build();
@oldtune
oldtune / cargo.toml
Created June 15, 2023 08:25
crawler rust
[package]
name = "crawler"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
tl = "0.7.7"
reqwest = { version = "0.11.18", features = ["gzip"] }
@oldtune
oldtune / cargo.toml
Created June 15, 2023 08:18
crawler piece of code reqwest tl-rs
[package]
name = "crawler"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
tl = "0.7.7"
reqwest = { version = "0.11.18", features = ["gzip"] }
@oldtune
oldtune / dataflow.cs
Created May 15, 2023 02:20
c# dataflow example for writing blog
//Program.cs file
@oldtune
oldtune / introrx.md
Created March 9, 2020 04:30 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing