This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(prelude_import)] | |
#![no_std] | |
#![feature(proc_macro)] | |
#[prelude_import] | |
use std::prelude::v1::*; | |
#[macro_use] | |
extern crate std as std; | |
#[macro_use] | |
extern crate serde_derive; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Function Attrs: noinline norecurse nounwind readnone uwtable | |
define zeroext i1 @valid_token(i32) unnamed_addr #0 { | |
entry-block: | |
%1 = and i32 %0, -33 | |
%2 = add i32 %1, -65 | |
%3 = icmp ult i32 %2, 26 | |
%.off14 = add i32 %0, -48 | |
%4 = icmp ult i32 %.off14, 10 | |
%or.cond17 = or i1 %4, %3 | |
br i1 %or.cond17, label %bb12, label %bb10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <codecvt> | |
inline std::wstring WidenString(const std::string &narrow) | |
{ | |
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter; | |
return converter.from_bytes(narrow); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate crossbeam; | |
fn main() { | |
let n = 100; | |
let mut data: Vec<_> = (0..n).collect(); | |
{ | |
let (left, right) = data.split_at_mut(n / 2); | |
crossbeam::scope(|scope| { | |
scope.spawn(|| { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[derive(TLType)] | |
pub enum InputPeer { | |
#[tl_id(_7f3b18ea)] | |
Empty, | |
#[tl_id(_7da07ec9)] | |
SelfPeer, | |
#[tl_id(_1023dbe8)] | |
Contact { user_id: i32 }, | |
#[tl_id(_9b447325)] | |
Foreign { user_id: i32, access_hash: i64 }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Push-Location | |
Set-Location HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\ | |
if (!(Test-Path "Personalize")) { | |
New-Item "Personalize" | |
} | |
Set-ItemProperty "Personalize" -Name AppsUseLightTheme -Type DWORD -Value 0 | |
Pop-Location |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(box_syntax)] | |
pub struct MyThing { | |
stuff: Vec<i32>, | |
} | |
pub trait DoAThing { | |
fn add(&mut self, item: i32); | |
fn remove(&mut self) -> i32; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int server_accept(int listener) | |
{ | |
sockaddr_storage client_address; /* This is big enough to store an IPv4 or IPv6 address */ | |
int address_size = sizeof(client_address); | |
int socket = accept(listener, &client_address, &address_size); | |
if (fork()) | |
{ | |
/* close now, it won't stop the connection until | |
* the child also closes it |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <typename T> | |
class rwlock | |
{ | |
T obj; | |
SRWLOCK lock; | |
class guard | |
{ | |
rwlock &rwl; | |
bool mut; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/********************************* | |
* CriticalSections.cpp | |
* Connor Hilarides | |
* Created 2014/08/07 | |
* Copyright © 2014 DigiPen Institute of Technology, All Rights Reserved | |
*********************************/ | |
#include "CriticalSections.h" |