Skip to content

Instantly share code, notes, and snippets.

#include <fcntl.h>
#include <sys/ioctl.h>
#include <hwdep.h>
#include <error.h>
#include <stdio.h>
#include "rt56xx_ioctl.h"
int main()
{
@checko
checko / 5670routemap
Created August 29, 2014 01:33
5670 route map
static const struct snd_soc_dapm_route rt5670_dapm_routes[] = {
#ifdef USE_ASRC
{"I2S1", NULL, "ASRC enable"},
{"I2S2", NULL, "ASRC enable"},
#endif
{ "micbias1", NULL, "DAC L1 Power" },
{ "micbias1", NULL, "DAC R1 Power" },
{ "DMIC1", NULL, "DMIC L1" },
@checko
checko / vmutt
Created November 4, 2014 08:23
#!/usr/bin/perl
# usage:
# vmutt [maildir] [command]
# eg.
# vmutt ~/mail/flagged "mutt -f ~/mail/flagged"
use warnings;
use strict;
use File::Basename qw/basename dirname/;
#!/bin/sh
#
# LightDM wrapper to run around X sessions.
echo "Running X session wrapper"
# Load profile
for file in "/etc/profile" "$HOME/.profile" "/etc/xprofile" "$HOME/.xprofile"; do
if [ -f "$file" ]; then
echo "Loading profile from $file";
hi DiffAdd term=reverse cterm=bold ctermbg=green ctermfg=white
hi DiffChange term=reverse cterm=bold ctermbg=cyan ctermfg=black
hi DiffText term=reverse cterm=bold ctermbg=gray ctermfg=black
hi DiffDelete term=reverse cterm=bold ctermbg=red ctermfg=black
:syntax on
:set smartindent
:set ls=2
colorscheme pablo
:set ffs=unix
@checko
checko / gist:2532242d43f507650b76
Created December 4, 2014 01:54
test, create partitions
#!/bin/bash
create_partition()
{
local part_type=$1
local part_num=$2
local part_size=$3
echo -n "create_partition($part_type, $part_num, $part_size)..."
case $part_type in
p|e|l);;
@checko
checko / gist:f97cd56226766684e1ec
Created December 4, 2014 01:52
ant, rules to copy resources
commit fe9083623469a2e8e533179226766b84bfcd09a9
Author: charles-chang <charles-chang@royaltek.com>
Date: Wed Dec 3 16:40:16 2014 +0800
fix nullpointerexceotion on ImageIcon
diff --git a/AndroidScreencast/build.xml b/AndroidScreencast/build.xml
index 58c87df..42b2a32 100644
--- a/AndroidScreencast/build.xml
+++ b/AndroidScreencast/build.xml
@checko
checko / chk_clear_cache.sh
Created January 8, 2015 02:39
check disk usage and clear cache
#!/bin/sh
mkdir /cbox
mount -t vfat /dev/block/mmcblk0p7 /cbox
uspct=$(df | grep cbox | awk '{ print $5 }' | cut -d'%' -f1)
echo $uspct
if [ $uspct -ge 90 ]; then
echo 'great!'
rm -r /cbox/Android
rm -r /cbox/DCIM
fi
@checko
checko / gist:296ad4d53eadd3b52548
Created February 16, 2015 03:34
rt5625 mic_ctrl sysfs
static ssize_t rt5625_mic_ctrl_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct i2c_client *client = to_i2c_client(dev);
struct rt5625_priv *rt5625 = i2c_get_clientdata(client);
struct snd_soc_codec *codec = rt5625->codec;
int data = snd_soc_read(codec, RT5625_MIC_CTRL);
return sprintf(buf, "%x",data);
@checko
checko / stack_trace.c
Last active September 10, 2015 09:09 — forked from banthar/stack_trace.c
stacktrace with libunwind and elfutils
// stack_trace.c
//
// gcc stack_trace.c -ldw -lunwind -g -o stack_trace
#define UNW_LOCAL_ONLY
#include <elfutils/libdwfl.h>
#include <libunwind.h>
#include <stdio.h>