Skip to content

Instantly share code, notes, and snippets.

View akirad's full-sized avatar

akirad akirad

  • Kawasaki, Japan.
View GitHub Profile
@akirad
akirad / calcCal.html
Created November 27, 2018 15:18
A html+js sample to calculate kcal by exercise.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-language" content="ja">
<meta charset="UTF-8">
<title>消費カロリー計算</title>
<script>
function calc() {
var weight = document.getElementById('weight').value;
@echo off
set pid=%1
:loop
set /p<nul=%date% %time%,
tasklist /fo csv /fi "pid eq %pid%" /nh
timeout 60 > nul
goto :loop
@akirad
akirad / sendtrap.pl
Last active August 12, 2018 15:56
Send trap perl script
use strict;
use warnings;
use Socket;
use Getopt::Long 'GetOptions';
#---------------
# Constant value
#---------------
my $V1_TRAP = 'a4';
my $V2c_TRAP = 'a7';
@akirad
akirad / findBOM.pl
Last active November 9, 2017 05:20
A perl script that finds BOM from the files under the directory specified.
use strict;
use warnings;
my $dir = $ARGV[0];
if((!$dir) or (! -d $dir)) {
    die "Need to specify a directory.";
}
my $isFound = 0;
checkBomFrom($dir);
@akirad
akirad / findStr.vbs
Last active May 31, 2023 03:10
A vbs script that finds files that contains the string specified from the directory.
Option Explicit
Dim objArgs
Set objArgs = WScript.Arguments
If objArgs.Count < 1 Then
WScript.Echo("Specify a dir...")
WScript.Quit (1)
End If
Dim strPattern
@akirad
akirad / listFile.vbs
Last active November 11, 2017 00:29
A vbs script which lists files in the specified dir.
Option Explicit
Dim objArgs
Set objArgs = WScript.Arguments
If objArgs.Count = 1 Then
Call listFile
End If
Sub listFile()
@akirad
akirad / ChangeBinHex.java
Last active August 9, 2017 09:49
A sample program to change bin to hex and hex to bin.
public class ChangeBinHex {
public static void main(String[] args) {
String str = "z";
String hexStr = binToHexString(str.getBytes());
System.out.println(hexStr); // 7a (0111 1100)
byte[] bytes = hexStrToBin(hexStr);
for (byte b : bytes) {
System.out.print(b + " "); // 122 (0111 1010) : Ascii Code of "z"
}
@akirad
akirad / sendUdpData.java
Last active August 7, 2017 02:07
A Java program which sends udp data.
// A sample to send a udp data.
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.io.File;
@akirad
akirad / findStr.pl
Last active July 31, 2016 09:55
A perl script which finds strings of file1(fromFile) against file2(toFile).
use strict;
use warnings;
use Getopt::Long;
my $notExist = 0;
my $fromFile;
my $toFile;
GetOptions(
'notExist' => \$notExist,
@akirad
akirad / findNonExistStr.pl
Last active May 25, 2016 11:35
A perl script which finds strings which are in the $checkStrFile($ARGV[0]) but not in the $targetFile($ARGV[1]).
use strict;
use warnings;
my $checkStrFile = $ARGV[0];
my $targetFile = $ARGV[1];
open(my $csFh, "< $checkStrFile") or die "Can't open $checkStrFile: $!";
open(my $tgtFh, "< $targetFile") or die "Can't open $targetFile: $!";
while (my $checkLine = <$csFh>) {