Skip to content

Instantly share code, notes, and snippets.

View takumaw's full-sized avatar

Takuma Watanabe takumaw

View GitHub Profile
function unpin_taskbar([string]$appname) {
((New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items() | Where-Object {$_.Name -eq $appname}).Verbs() | Where-Object {$_.Name.replace('&','') -match 'タスク バーからピン留めを外す'} | ForEach-Object {$_.DoIt()}
}
foreach ($taskbarapp in ("PowerPoint", "Excel")) {
Write-Host "Unpinning $taskbarapp"
unpin_taskbar("$taskbarapp")
}
@takumaw
takumaw / config.py
Created May 17, 2019 13:08
PowerDNS with Docker Compose
import os
basedir = os.path.abspath(os.path.dirname(__file__))
# BASIC APP CONFIG
WTF_CSRF_ENABLED = True
SECRET_KEY = 'We are the world'
BIND_ADDRESS = '0.0.0.0'
PORT = 9393
LOGIN_TITLE = "PDNS"
@takumaw
takumaw / citrix_force_non_seamless.reg
Last active December 21, 2022 08:55
Force Citrix Workspace to use non-seamless full screen windows
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\SOFTWARE\Citrix\ICA Client\Engine\Lockdown Profiles\All Regions\Lockdown\Virtual Channels\Seamless Windows]
"TopMostonFullScreen"=True
"TWIMode"=False
[HKEY_CURRENT_USER\SOFTWARE\Citrix\ICA Client\Engine\Lockdown Profiles\All Regions\Lockdown\Virtual Channels\Thinwire Graphics]
"TWIFullScreenMode"=True
"UseFullScreen"=True
@takumaw
takumaw / WSL2toHyperV.ps1
Last active June 28, 2022 04:47
WSL2 to HyperV
wsl --distribution Ubuntu --user root --cd ~ -- true
Get-NetIPInterface |
where {$_.InterfaceAlias -eq 'vEthernet (WSL)' -or $_.InterfaceAlias -eq 'vEthernet (Default Switch)'} |
Set-NetIPInterface -Forwarding Enabled
@takumaw
takumaw / AptAutoUpgrades.ps1
Last active June 28, 2022 04:40
Apt auto upgrades on WSL2
wsl.exe --distribution Ubuntu --user root --cd ~ -- /bin/zsh -c "sudo apt update; sudo apt upgrade -y; sudo apt autoremove -y; sudo apt autoclean"
@takumaw
takumaw / device-info.service
Last active May 13, 2020 16:44
TimeMachine using Samba and Avahi
<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">%h</name>
<service>
<type>_device-info._tcp</type>
<port>0</port>
<txt-record>model=Xserve</txt-record>
</service>
</service-group>
@takumaw
takumaw / noip-dns-update.sh
Created April 8, 2020 04:39
noip-dns-update.sh
#!/bin/zsh
USERNAME=""
PASSWORD=""
HOSTNAME=""
curl "https://$USERNAME:$PASSWORD@dynupdate.no-ip.com/nic/update?hostname=$HOSTNAME&myip=$(curl https://ifconfig.me 2> /dev/null),$(curl https://ifconfig.co 2> /dev/null)"

Textbox Cursor Position

これは何?

  • テキストボックス中のカーソル位置を取得し、また、カーソル位置にプレースホルダーを挿入するサンプルコードです。

各項目について

  • Target Textarea は、カーソル位置取得・プレースホルダ挿入対象のテキストボックスです。
  • Dummy Textarea や Dummy Text は、無関係のテキストボックス・段落です。
@takumaw
takumaw / docker-compose.yml
Created August 31, 2018 14:06
docker-compose.yml for use in enterprise environment
version: '3'
services:
xxx:
build:
context: dockerfile/
args:
- http_proxy=${http_proxy}
- https_proxy=${https_proxy}
- ftp_proxy=${ftp_proxy}
- no_proxy=${no_proxy}
@takumaw
takumaw / modify_windows_shortcut.ps1
Last active April 25, 2018 01:36
Modify Windows shortcut files
#
# Modify Windows shortcut files
#
# Path to find shortcuts from
# e.g.
# [string]$findPath = "\\myserver1\myfolder"
# -> Find shortcuts from "\\myserver1\myfolder".
[string]$findPath = "."