Skip to content

Instantly share code, notes, and snippets.

View nmreadelf's full-sized avatar
🛠️
Coding

nmreadelf nmreadelf

🛠️
Coding
  • Beijing
  • 04:25 (UTC +08:00)
View GitHub Profile
@nmreadelf
nmreadelf / bash
Created November 3, 2017 10:49
net nic irq balance
#!/bin/sh
# setting up irq affinity according to /proc/interrupts
# 2008-11-25 Robert Olsson
# 2009-02-19 updated by Jesse Brandeburg
#
18/10/15 17:00:34 WARN hdfs.DFSClient: DataStreamer Exception
java.io.IOException: Broken pipe
at sun.nio.ch.FileDispatcherImpl.write0(Native Method)
at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:47)
at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93)
at sun.nio.ch.IOUtil.write(IOUtil.java:65)
at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:471)
at org.apache.hadoop.net.SocketOutputStream$Writer.performIO(SocketOutputStream.java:63)
at org.apache.hadoop.net.SocketIOWithTimeout.doIO(SocketIOWithTimeout.java:142)
at org.apache.hadoop.net.SocketOutputStream.write(SocketOutputStream.java:159)
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.file.Paths;
import java.security.PrivilegedExceptionAction;
@nmreadelf
nmreadelf / how to install entware on ARM.md
Created November 15, 2018 01:43 — forked from dreamcat4/how to install entware on ARM.md
Install entware on ARM based router eg tomato / ddwrt / asus-merlin cfw
package main
import (
etcdv2 "./etdv2"
"context"
"flag"
"fmt"
log "github.com/golang/glog"
"os"
"os/signal"
package main
import (
"bufio"
"fmt"
"io"
"os"
"strconv"
"strings"
)
package main
import (
"fmt"
"syscall"
"unsafe"
)
type printFunc func()
@nmreadelf
nmreadelf / printf.cc
Created January 12, 2023 07:12
use c++ template implement printf
#include <iostream>
#include <string>
template <typename T> void printff(const char *s, const T &value) {
while (*s) {
if (*s == '%' && *++s != '%') {
std::cout << value;
}
std::cout << *s++;
}
@nmreadelf
nmreadelf / primes.c
Last active March 30, 2023 04:40
prime multi process
#include <stdio.h>
#include <stdlib.h>
#define MAX 35
int
generate() {
int p[2];
pipe(p);
for (int i = 2; i < MAX; i++) {
write(p[1], &i, sizeof(i));
[1.916575473999984,0.03150628399998823,0.027578895000004877],
[2.730124790000019,0.0355460239999843,0.03212929800000097],
[4.548399335999989,0.0554459229999793,0.04591217699999106],
[3.8823170790000177,0.07142975200002866,0.06455510299997513],
[5.245918164000045,1.5219750630000135,1.5234857080000097],
[5.312483166999982,0.7469967010000005,0.7559375019999948],
[2.6928228680000075,0.03283918700003596,0.028870116999996753],
[2.7443653910000307,0.04419770999999173,0.04313480999996955],
[4.549234023999986,0.4151060160000384,0.3666577019999977],
[8.868127841999979,0.48181567099999256,0.46717476399999214],