Skip to content

Instantly share code, notes, and snippets.

@drinkcat
drinkcat / gist:6482317
Last active December 22, 2015 13:58
awk version of branch matching
ADHD_HEAD="`awk '
BEGIN {
crosver = "'"$CROS_VER"'"
crosvers[0] = crosver
while (sub(/\.[^.]*$/, "", crosver))
crosvers[length(crosvers)] = crosver
bestmatch = length(crosvers)-1
}
sub(/refs\/heads\//, "", $2) {
@drinkcat
drinkcat / gist:6559868
Created September 14, 2013 08:12
Intellij Idea Community Edition console output
OpenJDK Runtime Environment (IcedTea 2.3.9) (ArchLinux build 7.u21_2.3.9-4-armv7h)
OpenJDK Zero VM (build 22.0-b10, mixed mode)
WARNING: You are launching the IDE using OpenJDK Java runtime.
ITS KNOWN TO HAVE PERFORMANCE AND GRAPHICS ISSUES!
SWITCH TO THE ORACLE(SUN) JDK BEFORE REPORTING PROBLEMS!
NOTE: If you have both Oracle (Sun) JDK and OpenJDK installed
please validate either IDEA_JDK, JDK_HOME, or JAVA_HOME environment variable points to valid Oracle (Sun) JDK installation.
See http://ow.ly/6TuKQ for more info on switching default JDK.
@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')
@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 / 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 / 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 / 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 / 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 / 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 / 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