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 rusqlite; | |
extern crate chrono; | |
use rusqlite::Connection; | |
#[allow(dead_code)] | |
fn lfsr3(x : u8) -> u8 { | |
let bit = ((x >> 0) ^ (x >> 1)) & 1; | |
(x >> 1) | (bit << 2) | |
} |
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 ocl; | |
extern crate image; | |
use ocl::traits::MemLen; | |
const SIZE: [u32; 2] = [1600, 1600]; | |
const PROGRAM: &'static str = r" | |
__kernel void init(__global uchar *buf, int height) { | |
int x = get_global_id(0); | |
int width = get_global_size(0); |
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
{-# LANGUAGE Arrows #-} | |
module Main where | |
import Prelude hiding (init, (.)) | |
import Control.Exception | |
import Control.Monad | |
import Data.Bits | |
import Foreign.C.Types |
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 chrono; | |
extern crate term; | |
extern crate ctrlc; | |
use chrono::duration::Duration; | |
use chrono::offset::utc::UTC; | |
use std::env::args; | |
use std::io; | |
use std::io::Write; | |
use std::thread; |
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
num = 768 # value | |
block_n = 32 | |
result = [] | |
while num > 0: | |
if num & 1 == 1: | |
result.append(block_n) | |
num >>= 1 | |
block_n -= 1 |
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
fn fizz(n: i32) -> String { | |
match n { | |
n if n % 15 == 0 => format!("{}", "FizzBuzz"), | |
n if n % 3 == 0 => format!("{}", "Fizz"), | |
n if n % 5 == 0 => format!("{}", "Buzz"), | |
n => format!("{}", n), | |
} | |
} |
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 <iostream> | |
#include <utility> | |
#include <tuple> | |
#include <algorithm> | |
#include <vector> | |
#include <math.h> | |
using namespace std; | |
const int N = 150; |
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
import Control.Monad | |
import Sound.ALUT | |
main = runALUT "" [] $ \_ _ -> do | |
listenerPosition $= Vertex3 0 0 0 | |
listenerVelocity $= Vector3 0 0 0 | |
buf <- createBuffer (Sawtooth 220 0 1) | |
buf2 <- createBuffer (Sawtooth 440 0 1) | |
sources@(s1:s2:_) <- genObjectNames 2 | |
forM_ sources $ \s -> do |
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
import Control.Monad.Trans | |
import Control.Monad | |
import Control.Applicative | |
import Graphics.UI.Gtk | |
data MainWindow = MainWindow | |
{ window :: Window | |
, mainContainer :: VBox | |
, scrollArea :: ScrolledWindow | |
, scrollContent :: TreeMVC String |