Skip to content

Instantly share code, notes, and snippets.

<# copilot prompt
テキストファイルに列挙したファイルのみを特定のフォルダにコピーするPowerShellのスクリプトを書いてください。
- コピーするファイル名は相対パスで列挙
- コピー元のフォルダはsourcePathに設定
- コピー先のフォルダはdestinationPathに設定
- コピーするファイル名を列挙したファイルのパスはfileListPathに設定
- ファイル名を列挙したファイルはUTF8で読み込む
- コピー中のファイルの情報を表示
- コピー先にファイルが存在する場合はコピーをスキップする
- コピー元のファイルは再帰的に検索する
@yoshimov
yoshimov / gist:2146576
Created March 21, 2012 12:21
Bookmarklet to create QR code for current page.
javascript:(function(){var l=window.location.href;void(window.open('https://chart.googleapis.com/chart?chs=300x300&cht=qr&chl='+l,'_blank'));})()
@yoshimov
yoshimov / Office_readonly.vbs
Created September 30, 2011 09:05
Windows Script to open Office files with read only.
Dim strFileName, strExt
Dim objApp
'Check arguments
If WScript.Arguments.Count <> 1 Then WScript.Quit
'get file name
strFileName = WScript.Arguments(0)
strExt = LCase(Right(strFileName, 4))
@yoshimov
yoshimov / check_version.sh
Last active September 21, 2022 20:16
check papermc builds and download latest jar file.
#!/bin/bash
# jq required
API="https://papermc.io/api/v2/projects/paper"
VER="1.17.1"
BUILDS_JSON=$(curl -s $API/versions/$VER)
#echo $BUILDS_JSON
LATEST=$(echo $BUILDS_JSON | jq '.builds[-1]')
<html>
<head>
<meta charset="utf-8">
<title>QR Shooter</title>
<script src="https://cdn.jsdelivr.net/npm/jsqr@1.4.0/dist/jsQR.min.js"></script>
<link href="https://fonts.googleapis.com/css?family=Ropa+Sans" rel="stylesheet">
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<style>
body {
font-family: 'Ropa Sans', sans-serif;
<!DOCTYPE html>
<html class=""><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>sample</title>
<body style="margin: 0px 0px 0px 126.5px; overflow: hidden;">
<script src="https://aframe.io/releases/0.8.2/aframe.min.js"></script>
<script src="https://cdn.rawgit.com/jeromeetienne/AR.js/1.5.5/aframe/build/aframe-ar.js"></script>
<a-scene embedded="" arjs="trackingMethod:best; debugUIEnabled:false;" class="" canvas="" inspector="" keyboard-shortcuts="" screenshot="" vr-mode-ui="">
<a-marker type="pattern" url="pattern-1414.patt">
<a-box position="0 0.8 0" wireframe="false" color="#843233" rotation="" scale="" visible="" material="" geometry="" src="" width="0.7" height="0.7" depth="0.7" >
@yoshimov
yoshimov / minecraft.service
Created July 11, 2021 06:56
systemd service for minecraft server
[Unit]
After=multi-user.target
[Service]
ExecStartPre=/home/ec2-user/check_version.sh
ExecStart=/usr/bin/java -Xmx7500M -Xms3000M -jar server.jar nogui
User=ec2-user
Restart=always
WorkingDirectory=/home/ec2-user
@yoshimov
yoshimov / WakeOnLan.groovy
Created November 27, 2008 04:51
Send Wake On LAN Magic Packet from Groovy script
// Send Wake On LAN Magic Packet
def int PORT = 9
def cli = new CliBuilder()
cli.h(longOpt: 'help', 'usage information')
cli.i(argName: 'networkInterface', longOpt: 'interface', args: 1, required: true, 'MAC address of network interface(IPv4)')
cli.b(argName: 'broadcast', longOpt: 'broadcast', args: 1, required: true, 'Broadcast address')
def opt = cli.parse(args)
@yoshimov
yoshimov / ingress-comm.js
Last active August 27, 2020 10:00
Collect Ingress COMM log with PhantomJS
/* SETTINGS */
var l='';
var p='';
var area = 'https://www.ingress.com/intel?ll=35.5841133,139.4988137&z=14';
var v = 20000; //Delay between capturing screenshots, in milliseconds (1000 ms = 1 s)
var reloadtime = 60000 * 120;
var width = 900; //Picture width
var height = 500; //Picture height
var folder = './'; //Folder where to save screenshots, with / (or \) on the end. '.' means current folder.
phantom.injectJs('settings.js');
@yoshimov
yoshimov / first-chocolatey.ps1
Created October 2, 2012 07:39
auto install script for initial setup at home.
# @powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://raw.github.com/gist/3817081/first-chocolatey.ps1'))"
# install Chocolatey
iex ((new-object net.webclient).DownloadString('http://bit.ly/psChocInstall'))
# basic
cinst vlc
cinst 7zip
cinst pdfcreator
cinst keepass
cinst git
cinst ccleaner