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
王 | |
江 | |
周 | |
胡 | |
刘 | |
李 | |
吴 | |
毛 | |
温 | |
习 |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# | |
# zipdb.py | |
# Use a zipfile store a dict like k-v database. | |
# Known bug: duplicate key(filenames) allowed | |
# | |
# Copyright 2012 mayli <mayli.he@gmail.com> | |
# |
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 Graphics.GD | |
import System.IO | |
import Data.Char | |
import System.Environment | |
charToColor::Char -> Color | |
charToColor ch = rgb c c c | |
where c = ord ch | |
orderToPosition (width, height) pos = (x, y) |
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.Concurrent | |
import Control.Concurrent.MVar | |
import Control.Monad.Fix (fix) | |
--seg:: MVar Int -> MVar Int -> Int -> IO () | |
seg mself mnext n loop = do | |
mn <- takeMVar mself | |
putStrLn $ show mn | |
putMVar mnext n | |
loop |
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 qualified Data.ByteString as B | |
import Data.Binary.Strict.Get | |
import System.IO | |
import Text.Printf (printf) | |
import System.Environment (getArgs) | |
import Control.Applicative ((<$>)) | |
import Data.Bits ((.|.), (.&.), shiftL, shiftR) | |
import Data.ByteString.UTF8 (toString) | |
import Text.JSON.Types | |
import Text.JSON (encode) |
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 java.io.BufferedInputStream; | |
import java.io.File; | |
import java.io.FileInputStream; | |
import java.io.IOException; | |
import java.io.InputStream; | |
/** | |
* unpacker for MA pack file | |
*/ | |
public final class Unpacker { |
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
(ns xxx.totp | |
(:import org.apache.commons.codec.binary.Base32)) | |
(def ^:const seed "QPA2GEXU3NNZUFKJL3NLZMC5YCA6UGSVDA3TFBJDXCZTQXYGYCYNKKWNU3IQG657CRWNUKNZGA3I2CLBUZYD3K55YZYQ====") | |
(def ^:const secret-size 10) | |
(def ^:const random-number-algorithm "SHA1PRNG") | |
(def ^:const window-size 3) | |
(defn new-secret | |
[] |
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
<?php | |
$a = [ | |
2 => 1, | |
3 => 1, | |
4 => 1, | |
6 => 5, | |
7 => 5, | |
8 => 5, | |
9 => 7, |
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
Failed to parse method: QSizePolicy::QSizePolicy | |
entity: Entity { kind: Constructor, display_name: Some("QSizePolicy(QSizePolicy::Bits)"), location: Some(SourceLocation { file: Some(File { path: "/usr/local/Cellar/qt/5.9.1/include/QtWidgets/qsizepolicy.h" }), line: 178, column: 38, offset: 7665 }) } | |
error: Can't parse argument type: b: QSizePolicy::Bits | |
Failed to parse method: QSizePolicy::Bits::transposed | |
entity: Entity { kind: Method, display_name: Some("transposed()"), location: Some(SourceLocation { file: Some(File { path: "/usr/local/Cellar/qt/5.9.1/include/QtWidgets/qsizepolicy.h" }), line: 210, column: 14, offset: 8607 }) } | |
error: Can't parse return type: QSizePolicy::Bits: Type uses private class (QSizePolicy::Bits) | |
Failed to parse method: QTypeInfo::name | |
entity: Entity { kind: Method, display_name: Some("name()"), location: Some(SourceLocation { file: Some(File { path: "/usr/local/Cellar/qt/5.9.1/include/QtWidgets/qsizepolicy.h" }), line: 231, column: 1, offset: 9205 }) } |
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
const LIST: &[u32] = &[0, 10, 20, 30, 40, 50, 60, 70, 80, 90]; | |
fn search(x: u32) -> usize { | |
let mut left: usize = 0; | |
let mut right: usize = LIST.len(); | |
println!("\n\nstart search x({}) in {:?}", x, LIST); | |
let mut step: u32 = 0; | |
while true { | |
let mid = (left + right) / 2; | |
let val = LIST[mid]; |
OlderNewer