Skip to content

Instantly share code, notes, and snippets.

@DeaR
DeaR / nyaos_sudo.lua
Last active December 14, 2015 15:09
NYAOSでUACを何とかしてみた
if nyaos.create_object then
local major, minor, build = nyaos.eval(os.getenv('COMSPEC') .. ' /c ver'):match('(%d+).(%d+).(%d+)')
if tonumber(major) >= 6 then
function nyaos.command.sudo(...)
local t = os.tmpname()
t = os.getenv('TEMP') .. '/' .. table.concat({string.byte(t, 1, t:len())})
nyaos.create_object('Shell.Application'):ShellExecute(nyaos.argv[0], '-e \034' .. table.concat({...}, ' ') .. ' > ' .. t .. ' ; echo \\nyaos_sudo_end\\ >> ' .. t .. '\034', nyaos.eval('pwd'), 'runas', 0)
local e
while e ~= '\\nyaos_sudo_end\\' do
f = io.open(t, 'r')
@DeaR
DeaR / shebang.lua
Last active December 14, 2015 06:59
shebang for NYAOS 3.x
-- Shebang for NYAOS 3.x
--
-- Maintainer: DeaR <nayuri@kuonn.mydns.jp>
-- Last Change: 13-Aug-2013.
-- License: MIT License {{{
-- Copyright (c) 2013 DeaR <nayuri@kuonn.mydns.jp>
-- Copyright (c) 2010 wantora
--
-- Permission is hereby granted, free of charge, to any person obtaining a
-- copy of this software and associated documentation files (the
@DeaR
DeaR / reparse_point.patch
Last active December 14, 2015 05:39
NYAOSの内蔵lsでリパースポイントを展開してみた(適当)
diff -r c95acae76050 lsf.cpp
--- a/lsf.cpp Sun Feb 24 15:47:59 2013 +0900
+++ b/lsf.cpp Tue Feb 26 19:34:27 2013 +0900
@@ -10,6 +10,8 @@
# include "ntcons.h"
# include <windows.h>
# include <wincon.h>
+# include <locale.h>
+# include <ddk/ntifs.h>
#endif
@DeaR
DeaR / Shaberu.lisp
Created February 6, 2013 11:05
このxyzzy…しゃべるぞ!
; Shaberu.l
; 元ネタ: http://blog.supermomonga.com/articles/vim/shaberu-vim.html
; 棒読みちゃんを起動しておいてください
; http://chi.usamimi.info/Program/Application/BouyomiChan/
(defconstant *shaberu-addr* "127.0.0.1")
(defconstant *shaberu-port* 50001)
(defun shaberu-say (str)
(with-open-stream (stream (connect *shaberu-addr* *shaberu-port*))
@DeaR
DeaR / unix_env_expand.lua
Last active December 11, 2015 21:38
Force expand of Unix style environment variable for NYAOS 3.x
-- Force expand of Unix style environment variable for NYAOS 3.x
--
-- Maintainer: DeaR <nayuri@kuonn.mydns.jp>
-- Last Change: 14-Aug-2013.
-- License: MIT License {{{
-- Copyright (c) 2013 DeaR <nayuri@kuonn.mydns.jp>
--
-- Permission is hereby granted, free of charge, to any person obtaining a
-- copy of this software and associated documentation files (the
-- "Software"), to deal in the Software without restriction, including
@DeaR
DeaR / complete_by.lua
Last active December 11, 2015 19:18
Complete by command for NYAOS 3.x
-- Complete by command for NYAOS 3.x
--
-- Maintainer: DeaR <nayuri@kuonn.mydns.jp>
-- Last Change: 13-Aug-2013.
-- License: MIT License {{{
-- Copyright (c) 2013 DeaR <nayuri@kuonn.mydns.jp>
-- Copyright (c) 2011 azu_re
-- Copyright (c) 2010 wantora
--
-- Permission is hereby granted, free of charge, to any person obtaining a
@DeaR
DeaR / abbreviations.lua
Last active December 11, 2015 17:08
Abbreviations for NYAOS 3.x
-- Abbreviations for NYAOS 3.x
--
-- Maintainer: DeaR <nayuri@kuonn.mydns.jp>
-- Last Change: 13-Aug-2013.
-- License: MIT License {{{
-- Copyright (c) 2013 DeaR <nayuri@kuonn.mydns.jp>
--
-- Permission is hereby granted, free of charge, to any person obtaining a
-- copy of this software and associated documentation files (the
-- "Software"), to deal in the Software without restriction, including
@DeaR
DeaR / galias.lua
Last active December 11, 2015 15:19
Global alias for NYAOS 3.x
-- Global alias for NYAOS 3.x
--
-- Maintainer: DeaR <nayuri@kuonn.mydns.jp>
-- Last Change: 13-Aug-2013.
-- License: MIT License {{{
-- Copyright (c) 2013 DeaR <nayuri@kuonn.mydns.jp>
--
-- Permission is hereby granted, free of charge, to any person obtaining a
-- copy of this software and associated documentation files (the
-- "Software"), to deal in the Software without restriction, including
@DeaR
DeaR / z.lua
Last active December 11, 2015 05:48
Porting z.sh for NYAOS 3.x
-- Porting z.sh for NYAOS 3.x
--
-- Maintainer: DeaR <nayuri@kuonn.mydns.jp>
-- Last Change: 13-Aug-2013.
-- License: MIT License {{{
-- Copyright (c) 2013 DeaR <nayuri@kuonn.mydns.jp>
--
-- Permission is hereby granted, free of charge, to any person obtaining a
-- copy of this software and associated documentation files (the
-- "Software"), to deal in the Software without restriction, including
@DeaR
DeaR / coding.lisp
Created June 29, 2012 13:55
encodingマジックコメントで-dos等を何とかしてみた #xyzzy
(defun find-file-buffer-encoding (arg)
"エンコーディングの自動判定"
(let ((encoding (gethash (substitute-string arg "-\\(dos\\|mac\\|unix\\)$" "" :case-fold t)
*mime-charset-name-hash-table*))
(eol (cond ((string-matchp "-dos$" arg)
*eol-crlf*)
((string-matchp "-mac$" arg)
*eol-cr*)
((string-matchp "-unix$" arg)
*eol-lf*))))