Skip to content

Instantly share code, notes, and snippets.

View hfm's full-sized avatar

Okumura Takahiro hfm

View GitHub Profile
@hfm
hfm / file.md
Last active December 29, 2015 23:39
diff -u kernel/kernel-2.6.32-358.23.2.el6/kernel.spec kernel/kernel-2.6.32-431.el6/kernel.spec
kernel/
├── kernel-2.6.32-358.23.2.el6
│   ├── kernel-2.6.32-358.23.2.el6.centos.plus.src.rpm
│   └── kernel.spec
└── kernel-2.6.32-431.el6
    ├── kernel-2.6.32-431.el6.centos.plus.src.rpm
    └── kernel.spec
/*
* Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
* The contents of this file constitute Original Code as defined in and
* are subject to the Apple Public Source License Version 1.1 (the
* "License"). You may not use this file except in compliance with the
* License. Please obtain a copy of the License at
* http://www.apple.com/publicsource and read it before using this file.
#include <stddef.h>
#include <string.h>
#include <memcopy.h>
#undef strcpy
/* Copy SRC to DEST. */
char *
strcpy (dest, src)
char *dest;
@hfm
hfm / rsync-flist.c.diff
Created December 9, 2013 00:54
$ diff -u rsync-3.0.7/flist.c rsync-3.0.8/flist.c
--- rsync-3.0.7/flist.c 2009-12-22 07:40:41.000000000 +0900
+++ rsync-3.0.8/flist.c 2011-02-22 03:20:58.000000000 +0900
@@ -52,12 +52,9 @@
extern int preserve_devices;
extern int preserve_specials;
extern int delete_during;
-extern int uid_ndx;
-extern int gid_ndx;
extern int eol_nulls;
@hfm
hfm / sample.c
Created December 16, 2013 00:41
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include <sys/uio.h>
#include <unistd.h>
int main()
{
@hfm
hfm / mmap.c
Created December 17, 2013 04:54
linux-2.6.32.61/fs/sysfs/bin.c
static int mmap(struct file *file, struct vm_area_struct *vma)
{
struct bin_buffer *bb = file->private_data;
struct sysfs_dirent *attr_sd = file->f_path.dentry->d_fsdata;
struct bin_attribute *attr = attr_sd->s_bin_attr.bin_attr;
struct kobject *kobj = attr_sd->s_parent->s_dir.kobj;
int rc;
mutex_lock(&bb->mutex);
#include <unistd.h>
int main(void){
pid_t pid = fork();
if (pid > 0) {
printf("I am the parent of pid=%d!\n", pid);
} else if (!pid){
printf("I am the baby!\n");
} else if (pid == -1) {
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
void child(void) {
int ret;
ret = execl("/usr/bin/touch", "touch", "test.txt", NULL);
if (ret == -1) {
perror("execv");
import dis
def foriter():
ilist = []
for i in range(3):
ilist.append(i)
return ilist
dis.dis(foriter)
@hfm
hfm / print_atexit_max.c
Last active January 1, 2016 04:49
Linuxシステムプログラミング p.143
#include <stdio.h>
#include <unistd.h>
int main(void)
{
long atexit_max = sysconf(_SC_ATEXIT_MAX);
printf("atexit_max = %ld\n", atexit_max);
return 0;
}