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
#!/bin/bash | |
if [ $# -lt 1 ]; then | |
percent=13 | |
printf "percent missing: using default value "$percent" %% \n" | |
else | |
percent=$1 | |
fi | |
type=png |
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
Raspberry Pi | |
http://item.taobao.com/item.htm?spm=a1z09.2.9.10.MbZ8cB&id=38987175483&_u=p30n4aoe69b | |
Shell | |
http://item.taobao.com/item.htm?spm=a1z09.2.9.40.MbZ8cB&id=40236827770&_u=p30n4ao46eb | |
Heat sink | |
http://item.taobao.com/item.htm?spm=a1z09.2.9.30.MbZ8cB&id=40272781292&_u=p30n4aoa8ab | |
Camera wire |
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
function gp() { | |
if [ $# -eq 0 ]; | |
then | |
count=10 | |
else | |
count=$1 | |
fi | |
cat /dev/urandom | tr -dc "a-zA-Z0-9" | fold -w 16 | head -n $count | |
} |
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 <stdio.h> | |
int main (int argc, const char * argv[]) { | |
unsigned int hi; | |
unsigned int lo; | |
long double result; | |
/* Set *hi and *lo to the high and low order bits of the cycle counter. | |
Implementation requires assembly code to use the rdtsc instruction. */ | |
asm("rdtsc; movl %%edx,%0; movl %%eax,%1" /* Read cycle counter */ |
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 | |
class Json_test extends Controller { | |
public function setter() { | |
$fp = fopen("/tmp/json_test.txt","w"); | |
$content = json_encode($_POST); | |
fwrite($fp, $content, strlen($content)); | |
fclose($fp); | |
echo $content; | |
} |
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
#!/bin/sh | |
TARGETFILE=allinone.c | |
if [ -e "$TARGETFILE" ]; then | |
rm -f "$TARGETFILE" | |
fi | |
if [ -n "$1" ]; then | |
printf "$1""\n" >> "$TARGETFILE" |
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 -*- | |
from datetime import datetime | |
from datetime import timedelta | |
now = datetime.now() | |
delta_day = timedelta(days = -1) | |
for i in range(21): | |
now += delta_day |
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 -*- | |
import random | |
x = int(raw_input("how many work items do you have? ")) | |
hours = [4,6,6,8,8,8,8,10,10,12,14] | |
for i in range(x): | |
print random.choice(hours) |
OlderNewer