This file contains hidden or 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
# INSTALL INSTRUCTIONS: save as ~/.gdbinit | |
# | |
# DESCRIPTION: A user-friendly gdb configuration file. | |
# | |
# REVISION : 7.3 (16/04/2010) | |
# | |
# CONTRIBUTORS: mammon_, elaine, pusillus, mong, zhang le, l0kit, | |
# truthix the cyberpunk, fG!, gln | |
# | |
# FEEDBACK: https://www.reverse-engineering.net |
This file contains hidden or 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
#[macro_use] | |
extern crate rocket; | |
use rocket::{Request, Outcome}; | |
pub struct BasicAuth { | |
pub username: Option<String>, | |
pub password: Option<String>, | |
} | |
impl<'a, 'r> FromRequest<'a, 'r> for BasicAuth { |
This file contains hidden or 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(try_trait)] | |
enum InnerError { | |
NoneError, | |
} | |
trait CustomError: std::error::Error { | |
fn description(&self) -> &str; | |
fn cause(&self) -> Option<&std::error::Error> { | |
None | |
} |
This file contains hidden or 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
//# [EN] https://hoverbear.org/2016/10/12/rust-state-machine-pattern/ | |
//# [RU] https://habr.com/ru/post/324382/ | |
fn main() { | |
// The `<StateA>` is implied here. We don't need to add type annotations! | |
let in_state_a = StateMachine::new("Blah blah blah".into()); | |
// This is okay here. But later once we've changed state it won't work anymore. | |
in_state_a.some_unrelated_value; | |
println!("Starting Value: {}", in_state_a.state.start_value); |
This file contains hidden or 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
use std::fmt; | |
struct ApiUrl<'a> { | |
host: &'a str, | |
port: &'a str, | |
path: &'a str, | |
} | |
impl Default for ApiUrl<'_> { | |
fn default() -> Self { |
This file contains hidden or 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
# Crystal cfib.cr | |
def fib(n) | |
if n <= 2 | |
1 | |
else | |
fib(n - 1) + fib(n - 2) | |
end | |
end | |
puts fib(42) | |
$ crystal build cfib.cr --release |
This file contains hidden or 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 hyper; | |
extern crate futures; | |
extern crate unicase; | |
use hyper::Post; | |
use hyper::header::{Headers, AccessControlAllowOrigin, AccessControlAllowHeaders}; | |
use hyper::server::{Http, Request, Response, Service}; | |
use futures::Stream; | |
use futures::future::*; | |
use unicase::Ascii; |
This file contains hidden or 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 hyper; | |
extern crate multipart; | |
extern crate hyper_native_tls; | |
use hyper::Client; | |
use hyper::net::HttpsConnector; | |
use hyper_native_tls::NativeTlsClient; | |
use multipart::client::lazy::Multipart; | |
use std::io::Read; |
This file contains hidden or 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
#![allow(unused)] | |
#![feature(generators, generator_trait)] | |
use std::ops::{Generator, GeneratorState}; | |
fn main() { | |
let mut generator = || { | |
yield 1; | |
return "foo" | |
}; |
This file contains hidden or 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
ALTER TABLE users | |
ADD COLUMN positions INTEGER[] NULL; | |
UPDATE users SET positions = '{}'; | |
ALTER TABLE users | |
ALTER COLUMN positions SET NOT NULL; | |
-- +-----------------+--------------------------+----------------------------------------------------------+ | |
-- | Column | Type | Modifiers | |