Skip to content

Instantly share code, notes, and snippets.

@jimmychu0807
jimmychu0807 / string-conversion.rs
Created November 21, 2019 10:20
Conversion between String, str, Vec<u8>, Vec<char> in Rust
use std::str;
fn main() {
// -- FROM: vec of chars --
let src1: Vec<char> = vec!['j','{','"','i','m','m','y','"','}'];
// to String
let string1: String = src1.iter().collect::<String>();
// to str
let str1: &str = &src1.iter().collect::<String>();
// to vec of byte
@RichardBronosky
RichardBronosky / README.MD
Last active April 26, 2024 08:21
cb - A leak-proof tee to the clipboard - Unify the copy and paste commands into one intelligent chainable command.

cb

A leak-proof tee to the clipboard

This script is modeled after tee (see [man tee][2]) and works on Linux, macOS, Cygwin, WSL/WSL2

It's like your normal copy and paste commands, but unified and able to sense when you want it to be chainable.

This project started as an answer to the StackOverflow question: [How can I copy the output of a command directly into my clipboard?][3]

@LieBtrau
LieBtrau / ble-scan.md
Last active October 13, 2021 05:33
Bluetooth Low Energy - Investigating unknown device

Get the ID of your local device

$ hcitool dev
Devices:
hci0	00:1A:7D:DA:71:13

Scan for BLE devices

$ sudo hcitool -i hci0 lescan
LE Scan ...
54:60:09:4A:6D:D9 (unknown)

   ^C

@ecylmz
ecylmz / iptables-limit.sh
Created July 27, 2012 10:40
Limit Connections Per Second
#!/bin/bash
# Source: http://www.cyberciti.biz/faq/iptables-connection-limits-howto/
IPT=/sbin/iptables
# Max connection in seconds
SECONDS=100
# Max connections per IP
BLOCKCOUNT=10
# ....