Skip to content

Instantly share code, notes, and snippets.

View Miezhiko's full-sized avatar
👗

Искорка Miezhiko

👗
View GitHub Profile
#[allow(non_snake_case)]
#[derive(Deserialize, Debug)]
struct WinLosses {
race: u32,
wins: u32,
losses: u32,
games: u32,
winrate: f64
}
fn ready(&self, ctx : Context, ready : Ready) {
info!("Connected as {}", ready.user.name);
voice::rejoin_voice_channel(&ctx);
let conf = conf::parse_config();
let last_guild_u64 = conf.last_guild.parse::<u64>().unwrap_or(0);
if last_guild_u64 != 0 {
let guild_id = GuildId( last_guild_u64 );
if let Ok(channels) = guild_id.channels(&ctx) {
let main_channel = channels.iter().find(|&(c, _)|
@Miezhiko
Miezhiko / words_counter.rs
Last active June 16, 2020 13:10
Words counter
extern crate unicase;
use std::{
collections::HashMap,
iter::FromIterator,
fs
};
use unicase::Ascii;
use sled;
use {
byteorder::{BigEndian},
zerocopy::{
byteorder::U64, AsBytes, FromBytes, LayoutVerified, Unaligned
}
};
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
fn f() {
let mut c: i64 = 1;
let d: i64 = 2;
let mut x: i64 = 3;
unsafe {
*(&mut x as *mut i64).sub(2) = 42;
}
println!("{c:?} {d:?} {x:?}");