Skip to content

Instantly share code, notes, and snippets.

View kaleocheng's full-sized avatar
🦀

Kaleo kaleocheng

🦀
View GitHub Profile
@kaleocheng
kaleocheng / ultrasonic_wave.c
Created June 21, 2014 08:26
Ultrasonic Wave 52MCU 12MHz
#include<reg52.h>
#include<stdio.h>
#define uchar unsigned char
#define uint unsigned int
sbit Trig = P1^5;
sbit Echo = P3^2;
@kaleocheng
kaleocheng / LinkList.c
Last active August 29, 2015 14:02
LinkList
//***********顺序表实现的电话簿程序*************************//
/*
*本程序为练习顺序表所写,仅实现了最基本的几个功能:添加,删除,查找联系人.
* 很多细节并未实现,如检验姓名,和手机号码是否合法,对重复姓名联系人的处理,按时间先后排序,按字母先后排序等.
* 程旭
* xuxiaofeng1994@gmail.com
*/
#include<stdio.h>
#include<string.h>
#include<stdio.h>
#define QueueType int
#define MAX 10
/*******************/
/*
队列的结构
*/
typedef struct
/*
push
*/
void push(STACK_TYPE value)
{
assert(!isFull());
topElement += 1;
arry[topElement] = value;
}
/*
@kaleocheng
kaleocheng / change_tint2_color
Last active August 29, 2015 14:03
自动改变颜色的小程序
#!/bin/bash
nitrogen /home/kaleo/images/wallpapers/ && python change_tint2_color.py && tint2restart &
@kaleocheng
kaleocheng / shift_wallpaper.sh
Created June 30, 2014 08:15
随机换壁纸
#!/usr/bin/env bash
#Fielname: shiftwallpaper(.sh)
WALLPAPER_DIR='/home/kaleo/images/wallpapers/shared'
WAIT=1800
function load_wallpapers()
{
n=0
@kaleocheng
kaleocheng / change_brightness.sh
Last active August 29, 2015 14:03
根据时间改变屏幕的亮度(配合crontab使用)
#!/usr/bin/env bash
#Filename: change_brightness.sh
#这个脚本会根据当前时间来改变系统屏幕的亮度,最好配合crontab来使用,而且我把他放在了/etc/rc.local中开机执行.
current_time=`date +%H`
case $current_time in
0|1|2|3|4|5|6|22|23)
#echo 'Night'
#这一句得用root权限来执行(sudo在这里也不行)
echo 0 > /sys/class/backlight/acpi_video0/brightness
#now=0
@kaleocheng
kaleocheng / movie.tex
Created July 9, 2014 07:45
用LaTeX向pdf中插入多媒体文件
\documentclass[12pt,landscape]{article}
\usepackage{geometry}
\geometry{verbose,letterpaper}
\usepackage{movie15}
\usepackage{hyperref}
\begin{document}
Whispering-gallery mode in a auarter circle:
\begin{figure}[ht]
\includemovie[
poster,
@kaleocheng
kaleocheng / SpeedTest.c
Last active August 29, 2015 14:04
PWM调速和光电传感器测速
#include<reg52.h>
#include<stdio.h>
#define uchar unsigned char
#define uint unsigned int
#define KongNums 20 //码盘上孔的数量
#define HighTime 500 //高电平持续时间
#define LowTime 500 //低电平持续时间