Skip to content

Instantly share code, notes, and snippets.

echo "Send signals from another console:"
echo "kill -USR1 $$"
SIG='force'
trap "SIG='USR1'" USR1
# Create a dummy FIFO. Reading the FIFO will block until interrupted by a signal
SIGFIFO="clip.fifo"
if [ ! -p "$SIGFIFO" ]; then
rm -f "$SIGFIFO"
@drinkcat
drinkcat / drm-fix.patch
Last active May 14, 2018 07:48
DRM fix
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 4177780..bbfc071 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -170,6 +170,9 @@ static struct drm_ioctl_desc drm_ioctls[] = {
#define DRM_CORE_IOCTL_COUNT ARRAY_SIZE( drm_ioctls )
+/* Allow set/drop master ioctls as normal user */
+static u32 drm_master_relax = 0;
@drinkcat
drinkcat / test.c
Last active January 2, 2016 04:39
#include <stdio.h>
/*
ARM output:
delay=45
delay=45
delay=97346
delay=-45
x86 output:
@drinkcat
drinkcat / test.c
Last active January 2, 2016 04:39
#include <stdio.h>
/* ARM output:
1000 / div = 10
-1000 / div = 42949662
-1000 / (long)div = -10
*/
int main() {
unsigned long div = 100;
@drinkcat
drinkcat / 01 mount and dmesg errors
Last active January 1, 2016 19:49
btrfs mount fail
[root@machin ~]# uname -a
Linux machin 3.13.0-rc5-custom #1 SMP PREEMPT Thu Dec 26 11:53:39 SGT 2013 x86_64 GNU/Linux
[root@machin ~]# mount /dev/sdb3 /home
mount: wrong fs type, bad option, bad superblock on /dev/sdb3,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so.
[root@machin ~]# dmesg -c
[ 3892.863456] btrfs: device label home devid 1 transid 29333 /dev/sdb3
@drinkcat
drinkcat / gist:7998826
Created December 17, 2013 02:13
Arch mirrors
# https://www.archlinux.org/mirrorlist/?country=US&protocol=http&ip_version=4&use_mirror_status=on
export CROUTON_MIRROR_arch='http://mirrors.lax1.thegcloud.com/arch/$repo/os/$arch'
# http://archlinuxarm.org/about/mirrors
export CROUTON_MIRROR_alarm='http://ca.us.mirror.archlinuxarm.org/armv7h/$repo'
@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)