Skip to content

Instantly share code, notes, and snippets.

View kapb14's full-sized avatar
😤

Aleksandr Karushin kapb14

😤
View GitHub Profile
@kapb14
kapb14 / gist:1b2ac855cbe764b20ce6
Created March 10, 2016 07:40
use 'read' in bash scripts
#
# http://wiki.bash-hackers.org/commands/builtin/read?s[]=read
#
> read -e -i "[txt_before]" -p "answer: " -t 10 myvariable ; echo $myvariable
answer: [txt_before]fuck
[txt_before]fuck
@kapb14
kapb14 / gist:09180f9f48965a047b8c
Created March 10, 2016 07:42
SQL Server 2014 unattend installation sample
::
cd /d Z:
cd Z:\SQL2014sp1entEn
setup.exe /Q /IACCEPTSQLSERVERLICENSETERMS /ACTION=install /FEATURES=SQL,AS,RS,IS,Tools
setup.exe /UpdateEnabled=0
@kapb14
kapb14 / gist:4feb7ea9a8c7872e1dbb
Created March 10, 2016 07:42
screenrc sample
startup_message off
vbell off
hardstatus alwayslastline "%{=b}%{G} %{b}%w %=%{kG}%C%A %D,%d/%m/%y"
shelltitle "Shell"
defscrollback 5024
@kapb14
kapb14 / thecus_commands.txt
Created March 10, 2016 07:43
THECUS useful commands and binaries locations
cd /var/log; tail -f log.* samba/samba.{n,s}mbd samba/samba.winbindd
@kapb14
kapb14 / reverse_ssh-tunnel_connect
Created March 14, 2016 08:07
callback подключение по SSH через туннель
#
# >> добавить в /etc/rc.local (или что-то типа того):
#
# turn on verbose logging
export AUTOSSH_DEBUG
# Sets the connection monitoring port.
export AUTOSSH_PORT=61000
# specifies the connection poll time in seconds; default is 600 seconds.
export AUTOSSH_POLL=300
@kapb14
kapb14 / use_chocolatey_in_windows10
Created March 14, 2016 08:40
chocolatey в windows 10
<#
В Windows 10 встроено управление поставщиками пакетов (оно же OneGet),
с помощью которого вы можете загрузить и тихо установить
сразу несколько приложений одной командой!
Примечание:
@kapb14
kapb14 / gist:ed4b68816380d15fe251
Last active March 15, 2016 17:29
запуск скрипта внутри babun-shell из ярлыка Windows
# Запуск 'tmux' с ярлыка Windows
%userprofile%\.babun\cygwin\bin\mintty.exe -e '/cygdrive/c/babun/.babun/cygwin/bin/tmux.exe'
# Запуск 'ssh' и подключение к удаленному серверу с ярлыка Windows
%userprofile%\.babun\cygwin\bin\mintty.exe -e '%userprofile%\.babun\cygwin\bin\ssh.exe' jump.adv.ru
@kapb14
kapb14 / Get-GistSudoCMD.ps1
Created April 2, 2016 17:03
Install 'sudo.cmd' script with Powershell
<#
.SYNOPSIS
Simple and dirty "hack" to have a "sudo" on Windows. Downloads script and places it into "C:\Windows\System32\".
.EXAMPLE
sudo powershell
.EXAMPLE
sudo notepad C:\Windows\System32\drivers\etc\hosts
.LINKS
https://gist.githubusercontent.com/kapb14/73121937ad36a50de271/raw/e75a44132fb024835a12a79bd9dc4181936bb325/sudo.cmd
#>
@kapb14
kapb14 / gist:829d37a27a68b600193ccda791f52ca3
Created April 2, 2016 17:10
Find and Install package via Powershell (v5)
$AllPackages = Find-Package
$pkg = $AllPackages | Out-GridView -OutputMode Single -Title "Choose a package"
$pkg | Select Name,Summary,Version,Links,Dependencies
$pkg | Install-Package -Force -Confirm:$false -Verbose
@kapb14
kapb14 / Select-UninstallPackage.ps1
Created April 2, 2016 17:18
Choose a package from 'Out-GridView' and Uninstall it.
<#
.SYNOPSIS
Choose a package from 'Out-GridView' and Uninstall it.
#>
$program = Get-Package | Out-GridView -OutputMode Single -Title "Choose Package to Uninstall"
$program | Select Name,Version,Summary,Status
$program | Uninstall-Package -Force -Verbose
<#
gcm -Module PackageManagement
man Uninstall-Package