Skip to content

Instantly share code, notes, and snippets.

@drinkcat
drinkcat / clipboard-test
Last active December 28, 2015 08:09
clipboard testing procedure
git 3662f3d96e438e80a474ebd0d04bca2c63aa6cd5
- Samsung ARM Chromebook, stable 4537.147.0
- precise: 12345678
- saucy: 12345
- wheezy: 12345
Testing procedure for clipboard sync:
0. (once only)
- In host-ext, run
- sh -e gencrx.sh
#!/bin/sh -e
# Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This file is sourced from main.sh to update distro-specific defaults.
# It must set at least ARCH and MIRROR if not already specified.
if [ -z "$ARCH" ]; then
ARCH="`uname -m | sed -e 's i.86 i386 ;s x86_64 amd64 ;s arm.* armhf ;'`"
@drinkcat
drinkcat / resetpart.sh
Created November 4, 2013 15:13
Resize stateful partition
#!/bin/sh
# Reset partition format (Samsung ARM Chromebook only!)
cgpt add -i 13 -t unused /dev/mmcblk0
cgpt add -i 1 -s 22073344 /dev/mmcblk0
partprobe /dev/mmcblk0
# We could resize2fs here, maybe after next reboot
@drinkcat
drinkcat / gist:7299500
Created November 4, 2013 08:03
test naming convention
0*: tester
1*: basic, background, upgrade
3*: cli-extra, audio
5*: DEs
9*: misc (e.g. chrome)
@drinkcat
drinkcat / gist:7260798
Last active December 27, 2015 03:39
Sample ps -eafj
UID PID PPID PGID SID C STIME TTY TIME CMD
root 1857 1 1857 1857 0 Oct29 ? 00:00:00 /usr/sbin/sshd
root 4601 1857 4601 4601 0 Oct29 ? 00:00:00 \_ sshd: chronos [priv]
chronos 4603 4601 4601 4601 0 Oct29 ? 00:02:38 | \_ sshd: chronos@pts/0
chronos 4604 4603 4604 4604 0 Oct29 pts/0 00:00:00 | \_ -bash
root 9140 4604 9140 4604 0 13:47 pts/0 00:00:00 | | \_ sudo enter-chroot -n wheezy sh -ec dd if=/dev/
root 9143 9140 9140 4604 0 13:47 pts/0 00:00:00 | | \_ /bin/sh -e /usr/local/bin/enter-chroot -n
root 9335 9143 9140 4604 0 13:47 pts/0 00:00:00 | | \_ su -s /bin/sh -c export SHELL='/bin/ba
chronos 9336 9335 9336 9336 0 13:47 ? 00:00:00 | | \_ -su -c export SHELL='/bin/bash';'s
chronos 9340 9336 9336 9336 0 13:47 ? 00:00:00 | | \_ sh -ec dd if=/dev/zero bs=4800
@drinkcat
drinkcat / squid.conf
Created October 30, 2013 05:49
sample squid configuration for Arch/Debian package cache
#
# Recommended minimum configuration:
#
# Example rule allowing access from your local networks.
# Adapt to list your (internal) IP networks from where browsing
# should be allowed
acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
@drinkcat
drinkcat / generate test.h
Last active December 26, 2015 07:49
CRAS allow 32-bit client to communicate with 64-bit server
# Generate cras/src/test.h that dumps the structures size and field relative offsets
awk 's && /};/ { s = 0; print; }
s { gsub(/[;\[].*$/, ""); gsub(/^.* \**/, ""); print "printf(\" "$0" @ %ld\\n\", (long)&(s." $0 ")-(long)&s);"; }
/^struct [^ ]* {$/ { s=1; print "{ struct " $2 " s; printf(\"sizeof("$2")=%zu\\n\", sizeof(s));" }
' common/cras_iodev_info.h common/cras_messages.h common/cras_types.h common/cras_shm.h > test.h
Then, add in cras/src/libcras/cras_client.c:
int cras_client_create(struct cras_client **client)
{
#include "../test.h"
@drinkcat
drinkcat / Performance
Last active November 28, 2019 10:32
Shell implementation of cpio
time sudo cpio -idm < ../bash-4.2-37.4.mga3.x86_64.cpiodec
Proper cpio:
real 0m0.031s
user 0m0.003s
sys 0m0.027s
Using dd:
real 0m3.277s
user 0m0.103s
@drinkcat
drinkcat / gendesk PKGBUILD patch
Last active December 24, 2015 03:29
netsurf-3.0-4 build failure on Arch Linux ARM, with gendesk fix
diff --git a/PKGBUILD b/PKGBUILD
index 1da05b7..4728eea 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -10,6 +10,7 @@ url='http://roboticoverlords.org/gendesk/'
license=('MIT')
makedepends=('go')
depends=('glibc')
+options=('!strip')
source=("http://roboticoverlords.org/$pkgname/$pkgname-$pkgver.tar.xz"
@drinkcat
drinkcat / PKGBUILD
Last active December 23, 2015 14:19
ruby-rmagick new PKGBUILD. Patch from https://github.com/bricef/rmagick/commit/689271fbb439dbf735f120811ac3b2dc79ba95a2 It seems to work for simple cases (at least we can compile and use rmagick), no idea how badly HDR images handling is broken.
# Contributor: Alexsandr Pavlov <kidoz at mail dot ru>
pkgname=ruby-rmagick
_gemname=${pkgname#ruby-}
pkgver=2.13.2
pkgrel=2
pkgdesc="Interface between the Ruby programming language and the ImageMagick"
arch=('i686' 'x86_64')
url="http://rmagick.rubyforge.org"
license=(MIT)
depends=('ruby' 'imagemagick' 'rubygems')