Skip to content

Instantly share code, notes, and snippets.

View oleksii-zavrazhnyi's full-sized avatar

Oleksii Zavrazhnyi oleksii-zavrazhnyi

View GitHub Profile
@oleksii-zavrazhnyi
oleksii-zavrazhnyi / gist:2012343ca608f9f1b069
Created June 3, 2014 21:38
Get AppStore Apps Icons list
// Paste this code in Console at
// https://itunes.apple.com/us/genre/ios-social-networking/id6005?mt=8
// The take a look at the end of page
$('.grid3-column li a').each(function(){
$('<div>').load($(this).attr('href'), function(){$('body').append('<div>' + $(this).find('.product .artwork img').attr('src') + '</div>')});
});
rsync -aHAXOxv --numeric-ids --delete --rsync-path="sudo -u www-data -i rsync" -e "ssh -T -c arcfour -o Compression=no -x" --exclude="exclude" ./local/path themengzor@remote.com:/
@oleksii-zavrazhnyi
oleksii-zavrazhnyi / topsites.js
Created October 23, 2014 19:21
Safari TopSites Preview Detection
if (window.navigator && window.navigator.loadPurpose === "preview") {
window.location.href = "https://www.icloud.com/topsites_preview/"
};
@oleksii-zavrazhnyi
oleksii-zavrazhnyi / gist:968e5ea87e99d9c41782
Created November 28, 2014 17:32
BASH Absolute path of current script
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )

Is a useful one-liner which will give you the full directory name of the script no matter where it is being called from

These will work as long as the last component of the path used to find the script is not a symlink (directory links are OK). If you want to also resolve any links to the script itself, you need a multi-line solution:

SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
on appIsRunning(appName)
tell application "System Events" to (name of processes) contains appName
end appIsRunning
if appIsRunning("QuickTime Player") then
tell application "QuickTime Player"
delay 1
try
close document 1 saving no
<!DOCTYPE html>
<html>
<head>
<title></title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
</head>
<body>
<form>
<input type="text" id="url"/> <button id="send">play</button>
</form>
@oleksii-zavrazhnyi
oleksii-zavrazhnyi / gist:6cc7caa68256aa4871cf
Created April 29, 2015 20:45
VirtualBox OS X parameters
VBoxManage.exe modifyvm "Yosemite 10.10 Retail" --cpuidset 00000001 000306a9 04100800 7fbae3ff bfebfbff
VBoxManage setextradata "Yosemite 10.10 Retail" "VBoxInternal/Devices/efi/0/Config/DmiSystemProduct" "MacBookPro11,3"
VBoxManage setextradata "Yosemite 10.10 Retail" "VBoxInternal/Devices/efi/0/Config/DmiSystemVersion" "1.0"
VBoxManage setextradata "Yosemite 10.10 Retail" "VBoxInternal/Devices/efi/0/Config/DmiBoardProduct" "Iloveapple"
VBoxManage setextradata "Yosemite 10.10 Retail" "VBoxInternal/Devices/smc/0/Config/DeviceKey" "ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc"
VBoxManage setextradata "Yosemite 10.10 Retail" "VBoxInternal/Devices/smc/0/Config/GetKeyFromRealSMC" 1
/System/Library/CoreServices/PlatformSupport.plist
@oleksii-zavrazhnyi
oleksii-zavrazhnyi / .screenrc
Last active October 8, 2016 01:05
.screenrc
termcapinfo xterm ti@:te@
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm' # Tell screen how to set colors. AB = background, AF=foreground
hardstatus alwayslastline
hardstatus string '%{= w}%-w[ %{= g}%n %t%{-} ]%+w%=%{=b r}%H%{-} %{= Y}%l%{-} %{=b m}%d.%m.%Y %c:%s%{-}'
nethack on
scrollback 20000
defscrollback 20000
altscreen on
@oleksii-zavrazhnyi
oleksii-zavrazhnyi / speedtest.sh
Last active May 17, 2017 22:47
CLI speedtest
curl -fsSL https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python -