Skip to content

Instantly share code, notes, and snippets.

@maijou2501
maijou2501 / dpkg_rc_purge.sh
Last active August 29, 2015 14:21
uninstall, dpkg rc status packages.
#!/bin/bash
dpkg --purge `dpkg -l|grep ^rc|sed 's/\s\{1,\}/ /g'|cut -d" " -f2`
@maijou2501
maijou2501 / mpi_host.c
Last active August 29, 2015 14:21
OpenMPI, display nodes
#include <mpi.h>
#include <stdio.h>
int main(int argc, char **argv){
int my_rank, my_size, name_len;
char processor_name[MPI_MAX_PROCESSOR_NAME];
MPI_Init(&argc,&argv);
MPI_Comm_size(MPI_COMM_WORLD,&my_size);
@maijou2501
maijou2501 / mpi_reduce.c
Created May 20, 2015 15:19
OpenMPI, MPI_Reduce test
#include <mpi.h>
#include <stdio.h>
#include <stdint.h>
int main(int argc, char **argv){
int my_rank, my_size, name_len;
unsigned long long my_sum=0, sum=0, count, i;
char my_name[MPI_MAX_PROCESSOR_NAME];
@maijou2501
maijou2501 / cuda.cu
Created May 20, 2015 15:23
CUDA, test
#include <stdio.h>
#include <stdint.h>
__global__ void add (unsigned long long *c) {
unsigned long long i = blockDim.x * blockIdx.x + threadIdx.x;
c[i] = i+1;
}
int main(int argc, char **argv){
@maijou2501
maijou2501 / mpi4cuda.cu
Created May 20, 2015 15:24
CUDA+OpenMPI, test
#include <mpi.h>
#include <stdio.h>
__global__ void add (int rank, unsigned long long *c) {
unsigned long long i = blockDim.x * blockIdx.x + threadIdx.x;
c[i] = ( rank - 1 ) * blockDim.x + i + 1;
}
int main(int argc, char **argv){
@maijou2501
maijou2501 / all-ssh.sh
Created May 21, 2015 02:03
remote some nodes
#!/bin/bash
user="root"
file="ip_list.txt"
identity="id_rsa"
if [ $# -ne 1 ];then
echo "usage: sh ./all-ssh.sh 'command here'"
exit 1
fi
@maijou2501
maijou2501 / all-status.sh
Created May 21, 2015 02:07
status some nodes
#!/bin/sh
file="ip_list.txt"
cat $file | while read ip
do
# windows
#if ! ping -n 1 -w 1 ${ip} 1>/dev/null 2>/dev/null ; then
# linux
if ! ping -c 1 -w 1 ${ip} 1>/dev/null 2>/dev/null ; then
@maijou2501
maijou2501 / ip.bat
Created May 21, 2015 04:28
Display IP address simply
@for /F "delims=: tokens=1" %%a in ('ipconfig ^| findstr "イーサネット"') do @echo %%a
@for /F "delims=: tokens=2" %%b in ('ipconfig ^| findstr "IPv4"') do @echo %%b
pause
@maijou2501
maijou2501 / del_share.reg
Created May 21, 2015 06:47
Delete, default secret share setting (1)
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\LanmanServer\Parameters]
"ServiceDll"=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,\
00,74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,\
73,00,72,00,76,00,73,00,76,00,63,00,2e,00,64,00,6c,00,6c,00,00,00
"ServiceDllUnloadOnStop"=dword:00000001
"EnableAuthenticateUserSharing"=dword:00000000
"NullSessionPipes"=hex(7):00,00
"autodisconnect"=dword:0000000f
@maijou2501
maijou2501 / del_share.bat
Created May 21, 2015 06:47
Delete, default secret share setting (2)
net share C$ /delete
net share D$ /delete
net share ADMIN$ /delete
net share print$ /delete
del_share.reg