Skip to content

Instantly share code, notes, and snippets.

View jparmstrong's full-sized avatar

J.P. Armstrong jparmstrong

  • New York
View GitHub Profile
@jparmstrong
jparmstrong / string-conversion.rs
Created November 24, 2022 03:59 — forked from jimmychu0807/string-conversion.rs
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
Emoji fun with KDB+/Q
unicode table: https://en.wikipedia.org/wiki/Emoji
h:8#-8!`$"😀" / get symbol header in bytes
d:8_-8!`$"😀" / starting emoji
10 cut {-9!h,x}@'(enlist[4#d] cross "x"$128 + til 64) cross 0x0
`😀`😁`😂`😃`😄`😅`😆`😇`😈`😉
`😊`😋`😌`😍`😎`😏`😐`😑`😒`😓
`😔`😕`😖`😗`😘`😙`😚`😛`😜`😝
`😞`😟`😠`😡`😢`😣`😤`😥`😦`😧
q){1 " ",string[x],"% "; 1 x#"=";1 "\r";system"sleep 0.1"}@'til 100;-1 "Done!";
/ 37% =====================================
/ Done!===================================================================================================
$ git status
On branch branch2
Your branch is up-to-date with 'origin/branch2'.
nothing to commit, working directory clean
$ git merge master
Auto-merging readme.md
CONFLICT (content): Merge conflict in readme.md
Automatic merge failed; fix conflicts and then commit the result.
$ git diff
diff --cc readme.md
@jparmstrong
jparmstrong / gist:d739d456cadf84be897a0825215786b5
Created August 28, 2016 15:19
Installing q/32 on Ubuntu 16.04
In order to get kdb+/q 32-bit running on Ubuntu 64-bit you'll need to install:
```
sudo apt-get install gcc-multilib
```
Ubuntu no longer packages ia32-libs for 64-bit builds.