Skip to content

Instantly share code, notes, and snippets.

View teknoraver's full-sized avatar
🖥️
coding

Matteo Croce teknoraver

🖥️
coding
View GitHub Profile
#!/bin/sh
{ awk -f /dev/stdin |aplay -r 44100 ; } <<'EOF'
function wl() {
rate = 44100
return (rate / 160) * 2^(-int(rand() * 10) / 5)
}
BEGIN {
srand()
wla = wl()
#!/usr/bin/perl -w
my $lastquot = '';
while(<>) {
$quot = /<(.*)> (.*)/;
$quot = $1;
$line = $2;
if($lastquot ne $quot) {
print "»\n" if($lastquot);
print "$quot: «";
#!/bin/sh
archs='i386 i486 i586 pentium pentium-mmx pentiumpro i686 pentium2 pentium3 pentium3m pentium-m pentium4 pentium4m prescott nocona core2 nehalem westmere sandybridge ivybridge haswell broadwell bonnell silvermont knl k6 k6-2 k6-3 athlon athlon-tbird athlon-4 athlon-xp athlon-mp k8 opteron athlon64 athlon-fx k8-sse3 opteron-sse3 athlon64-sse3 amdfam10 barcelona bdver1 bdver2 bdver3 bdver4 btver1 btver2 winchip-c6 winchip2 c3 c3-2 geode'
dryes() {
local sum=0 res=0
for i in $(seq 1 $1); do
res=$(./dry 2>/dev/null |awk '/^Dhrystones/{print$4}')
sum=$((sum + res))
done
--- a/src/progress.c
+++ b/src/progress.c
@@ -929,7 +929,7 @@ create_image (struct bar_progress *bp, d
*/
#define PROGRESS_FILENAME_LEN MAX_FILENAME_COLS + 1
-#define PROGRESS_PERCENT_LEN 4
+#define PROGRESS_PERCENT_LEN 5
#define PROGRESS_DECORAT_LEN 2
#define PROGRESS_FILESIZE_LEN 7 + 1
#include <stdio.h>
#include <errno.h>
#include <qrencode.h>
/* gcc -O2 qrc.c -o qrc -lqrencode */
int main(int argc, char *argv[])
{
int i, j;
if(argc < 2)
return 0;
#!/bin/sh
[ -d "$1/.git" ] || exec echo "$1 is not a git repository"
cp -r $1/.git .
git checkout AndroidManifest.xml && git mv -f AndroidManifest.xml app/src/main/
git checkout res && {
rm -rf app/src/main/res/
git mv res app/src/main/
}
#!/bin/sh
rulefile=/etc/udev/rules.d/51-android.rules
url=http://developer.android.com/tools/device.html
rule='/<td><code>....<\/code><\/td>/{print "SUBSYSTEM==\"usb\", ATTR{idVendor}==\""$5"\", MODE=\"0660\", GROUP=\"plugdev\""}'
curl -s $url | awk -F'<|>' "$rule" >$rulefile
chmod 755 $rulefile
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/mman.h>
#define BLOCK 65536
/*
#!/bin/sh
eval $(awk -F':| +' '/^(MemTotal|Cached|Buffers|MemFree)/{print $1"="int($3/1024)}' /proc/meminfo)
for fs in $(awk '/tmpfs/{print$2}' /proc/mounts); do
Cached=$((Cached - $(df -m $fs |awk '!/File system/{print$3}')))
done
exec echo " Total Avail (Cached + Buffers + Free)
$MemTotal $((Cached + Buffers + MemFree)) ($Cached + $Buffers + $MemFree)"
#!/bin/sh
# Taken from http://dev.gentoo.org/~vapier/clean-patches
# Adapted by me for gsed compatibility
# added binary files and stript first path element by teknoraver
exec sed $sedopt \
-e '/^index /d' \
-e '/^new file mode /d' \
-e '/^Index:/d' \