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
// [snippet: Async socket server using F# async computations.] | |
open System | |
open System.IO | |
open System.Net | |
open System.Net.Sockets | |
open System.Threading | |
type Socket with | |
member socket.AsyncAccept() = Async.FromBeginEnd(socket.BeginAccept, socket.EndAccept) |
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
#nowarn "40" | |
type Microsoft.FSharp.Control.Async with | |
static member AwaitObservable (evt : IObservable<'a>) = | |
Async.FromContinuations (fun (cont, econt, ccont) -> | |
let rec callback value = | |
sub.Dispose () | |
cont value | |
and sub : IDisposable = evt.Subscribe callback | |
()) |
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
module Signal | |
open System | |
type Function = | |
| Line | |
| Sine | |
| Square | |
| Triangle | |
| Sawtooth |
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
set drawcall (0) | |
-set shader:Unified (1) | |
--set color:red (2) | |
---set shape:box (3) | |
---unset shape:box (3) | |
---set drawcall (4) | |
----set attrib (5) | |
----unset attrib (5) | |
---unset drawcall (4) | |
---set uniform (6) |
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
LZMA Options: | |
level | |
Description: The compression level. | |
Range: [0;9]. | |
Default: 5. | |
dictSize | |
Description: The dictionary size. |
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
<?xml version="1.0" encoding="utf-8"?> | |
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<PropertyGroup> | |
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | |
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | |
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{F2A71F9B-5D33-465A-A702-920D77279786};{4925A630-B079-445D-BCD4-3A9C94FE9307}</ProjectTypeGuids> | |
<!-- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{380F0F87-E153-4FCF-A19F-75E1006BB24C}</ProjectTypeGuids> --> | |
<!-- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> --> | |
<!-- <ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{F2A71F9B-5D33-465A-A702-920D77279786}</ProjectTypeGuids> --> | |
<ProjectGuid>{14980659-6907-4542-95C4-054D54680FCA}</ProjectGuid> |
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
# author : Alex Rozgo | |
# date : Sun Jun 6 2004 | |
# copyright : DoWhatEverYouWantWithIt LICENSE | |
# email : [email protected] | |
# | |
# This is a simple demostration of genetic algorithms. | |
# Given these digits: '0,1,2,3,4,5,6,7,8,9' the algorithm | |
# must combine them with these operators '+,-,*,/' and | |
# find an equation that can evaluate to a given target. | |
# I'll be using binary encoded genes to represent |
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
========================================== ========================================== | |
TMUX COMMAND WINDOW (TAB) | |
========================================== ========================================== | |
List tmux ls List ^b w | |
New -s <session> Create ^b c | |
Attach att -t <session> Rename ^b , <name> | |
Rename rename-session -t <old> <new> Last ^b l (lower-L) | |
Kill kill-session -t <session> Close ^b & |
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::io::{self, Result}; | |
/// let mut rdr = Cursor::new(buf); | |
/// let num = rdr.read_varint().unwrap(); | |
pub trait VarintReader: io::Read { | |
fn read_varint(&mut self) -> Result<u64> { | |
fn decode<F>(i : u64, mut next : F) -> u64 |
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
pub fn say<'a>(vox_out_rx: futures::sync::mpsc::Receiver<Vec<u8>>, | |
udp_tx: futures::sync::mpsc::Sender<Vec<u8>>, | |
crypt_state: Arc<Mutex<ocbaes128::CryptState>>) | |
-> impl Future<Item = (), Error = Error> + 'a { | |
// Hz * channel * ms / 1000 | |
let sample_channels: u32 = 1; | |
let sample_rate: u32 = 16000; | |
let sample_ms: u32 = 10; | |
let sample_size: u32 = sample_rate * sample_channels * sample_ms / 1000; |