Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
buildsh=$(mktemp /tmp/buildsh.XXXXXX)
cat <<-EOF > $buildsh
buildctl-daemonless.sh build \
--frontend=dockerfile.v0 \
--local context=. \
--local dockerfile=. \
--output type=oci,name=example:latest,dest=output.tar
@h2onda
h2onda / .screenrc
Created October 13, 2020 01:21
screenrc
defutf8 on
defencoding utf8
encoding utf8 utf8
startup_message off
escape ^Tt
defscrollback 10000
altscreen on
diff -up nc/netcat.c.deferaccept nc/netcat.c
--- nc/netcat.c.deferaccept 2015-08-12 10:39:57.408000840 +0900
+++ nc/netcat.c 2015-08-12 10:39:24.071001056 +0900
@@ -917,6 +917,11 @@ set_common_sockopts(int s)
&Tflag, sizeof(Tflag)) == -1)
err(1, "set IP ToS");
}
+ if (!uflag) {
+ if (setsockopt(s, IPPROTO_TCP, TCP_DEFER_ACCEPT,
+ &x, sizeof(x)) == -1)
#include <stdio.h>
#include <fcntl.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
int main(void)
{
int fd, ret;
char filename[] = "testfile";
@h2onda
h2onda / parse_netstat.py
Last active August 29, 2015 14:27
parse /proc/net/netstat
#!/usr/bin/env python
import sys
buf=[]
for idx, line in enumerate(sys.stdin.readlines()):
buf.append(line.split())
if idx%2:
for entry in zip(*buf):
print "%s\t%s" % entry
@h2onda
h2onda / parse_netstat.rb
Created August 12, 2015 06:12
part /proc/net/netstat
#!/bin/env ruby
buf=[]
ARGF.readlines.each_with_index{|line,idx|
buf<<line.split
if (idx%2==1) then
buf.transpose.each{|l|
puts "%s\t%s" % l
}
buf=[]
@h2onda
h2onda / split_crashlog.rb
Last active August 29, 2015 14:26
separate crash log
#!/usr/bin/env ruby
ARGF.read.split(/crash>/).each_with_index{|str,idx|
open("%02g%s.log" % [idx, str.lines[0].gsub(" ","_").chomp], "w"){|file|
file << "crash>" << str
}
}
diff -uNrp kernel.spec.orig kernel.spec.new
--- kernel.spec.orig 2014-11-07 06:55:55.835002982 +0900
+++ kernel.spec.new 2014-11-07 06:58:25.621000048 +0900
@@ -15,6 +15,7 @@ Summary: The Linux kernel
# by setting the define to ".local" or ".bz123456"
#
# % define buildid .local
+%define buildid .cifsinoupd
%define distro_build 504
@h2onda
h2onda / linux-2.6.32-504.el6-cifs_update_inode_cache.patch
Last active August 29, 2015 14:08
cifs: update the inode cache with the results from a FIND_*
Subject: cifs: update the inode cache with the results from a FIND_*
See also: https://github.com/torvalds/linux/commit/cd60042cc1392e79410dc8de9e9c1abb38a29e57
See also: https://github.com/torvalds/linux/commit/2f2591a34db6c9361faa316c91a6e320cb4e6aee
================================
diff -uNrp kernel-2.6.32-504.el6.orig/linux-2.6.32-504.el6.x86_64/fs/cifs/readdir.c kernel-2.6.32-504.el6.new/linux-2.6.32-504.el6.x86_64/fs/cifs/readdir.c
--- linux-2.6.32-504.el6.x86_64/fs/cifs/readdir.c 2014-09-16 14:20:00.000000000 +0900
+++ linux-2.6.32-504.el6.x86_64/fs/cifs/readdir.c 2014-11-07 06:51:30.746015526 +0900
@@ -74,6 +74,7 @@ cifs_readdir_lookup(struct dentry *paren
struct dentry *dentry, *alias;
@h2onda
h2onda / mkdriverdisk.sh
Last active August 29, 2015 14:04
create driver disk from specified rpm package
#!/bin/bash
usage() {
echo "Usage: $(basename $0) [ -o filename.iso ] [driver.rpm ...]"
}
create_disk_template() {
rv=1
echo "Driver Update Disk version 3" > $workspace/rhdd3