Skip to content

Instantly share code, notes, and snippets.

typedef enum { false,
true } bool;
bool IsBigEndian()
{
int a = 0x1234;
char b = *(char *)&a; //通过将int强制类型转换成char单字节,通过判断起始存储位置。即等于 取b等于a的低地址部分
if (b == 0x12)
{
return true;
#[macro_use]
extern crate comp;
fn main() {
println!("Hello, world!");
let iter = iter! {
let x <- 0..2u8;
let y <- vec!['a', 'b'];
(x, y)
};
alias cargo-fmt="cargo fmt -- --write-mode=overwrite -v"
mix_dep {:httpotion, "~> 3.0.2"}
ret = HTTPotion.get "https://static.ifood360.com/03ce19e7a2da4f0f87bc872fc77f5e84.jpg?iopcmd=thumbnail&type=13&width=400&height=300"
:crypto.md5(ret.body) |> Base.encode16(case: :lower) |> IO.puts
val stringStream = Stream.of(*(1..10).toList().map(Int::toString).toTypedArray())
stringStream.parallel().map {
"thread ${Thread.currentThread()}: $it"
}.forEach(::println)
#!/bin/bash
port=$1
if [ "$port" = "" ]; then
echo "please input the port for check!"
exit 1
fi
max_attempts=10
package demo
import java.security.SecureRandom
import java.util.*
import javax.crypto.KeyGenerator
fun main(args: Array<String>) {
val kgs = listOf(KeyGenerator.getInstance("AES").apply { init(SecureRandom()) },
KeyGenerator.getInstance("AES").apply { init(128) })
@itang
itang / sort.md
Last active July 23, 2016 11:51
go web framework 和 orm star数排名

web framework

Beego https://github.com/astaxie/beego : 7607
Gin https://github.com/gin-gonic/gin : 7153
Revel https://github.com/revel/revel : 7051
Echo https://github.com/labstack/echo : 4956
go-kit https://github.com/go-kit/kit : 4813
Iris https://github.com/kataras/iris : 4451
httprouter https://github.com/julienschmidt/httprouter : 3408
mux https://github.com/gorilla/mux : 2581
@itang
itang / qrcode.go
Last active July 8, 2016 11:16
二维码识别 golang
package main
import (
"fmt"
//"github.com/shezadkhan137/go-qrcode/qrcode"
"encoding/base64"
"io/ioutil"
"strings"
interface Nameable {
String getName();
}
public class Test {
public static void main(String[] args) {
Nameable nameable1 = "String"::toString;
hello(nameable1);