This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
// Place your snippets for JavaScript React here. Each snippet is defined under a snippet name and has a prefix, body and | |
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are: | |
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the | |
// same ids are connected. | |
// Example: | |
"Print to console": { | |
"prefix": "log", | |
"body": [ | |
"console.log('$1');", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Calculate number of weekdays between two dates. | |
* | |
* @param string $from Start date, in format "YYYY-MM-DD" | |
* @param string $to End datem in format "YYYY-MM-DD" | |
* @return int|null Number of weekdays between $from and $to. NULL if either $from or $to is NULL. | |
*/ | |
static function date_diff_weekdays($from, $to) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
Wrapper script to compress multiple hard linked files. | |
Hard links are preserved after compression. | |
It does this by removing all but one of the links, compressing the data under the remaining name, | |
then respectively linking again to the newly compressed file (but with added suffix e.g ".bz2") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Download latest Firefox 32-bit installer for Windows | |
# | |
url=$(wget -S --max-redirect 0 \ | |
"https://download.mozilla.org/?product=firefox-latest&os=win" 2>&1 \ | |
| grep "^Location" | cut -d ' ' -f 2) | |
if [ $# -ne 0 ]; then { echo $url; return 0; }; fi | |
wget "$url" -O "${url##*/}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Download latest Sublime Text 3 installer | |
url=$(curl -s "https://www.sublimetext.com/3" \ | |
| grep "dl_linux.*tarball" \ | |
| cut -d '"' -f 6) | |
curl "$url" -o ${url##*/} | |
# Example of installation: | |
# | |
# tar -jxvf sublime_text_3_build_3126_x64.tar.bz2 -C ~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Download latest Adobe Reader 11 update installer | |
# | |
page2=$(curl -s "http://supportdownloads.adobe.com/product.jsp?product=10&platform=Windows" \ | |
| grep "Adobe Reader 11.*update - All" \ | |
| head -n 1 \ | |
| cut -d '"' -f 2) | |
echo "> $page2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Download latest stable LibreOffice for Windows x86 | |
# | |
urla=$(curl -s "https://www.libreoffice.org/download/download/" \ | |
| grep "option.*type=win-x86\&" | head -n 2 | cut -d '"' -f 2 | tail -n 1) | |
urlb=$(curl -s "$urla" | grep "\.msi" | grep -v "torrent" | tail -n 1 | cut -d '"' -f 6) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Download latest JRE for Windows x64 | |
page="http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html" | |
# Edit this for other platforms | |
url=$(curl -s "$page" \ | |
| grep "downloads\[.*jre-.*filepath" | cut -d ',' -f 3 | cut -d '"' -f 4 | grep "x64.exe$") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
setlocal | |
:: set target and source directory, do not use a trailing slash | |
:: recommended: sync to a subdir on target drive | |
set source_drive=z: | |
set target_drive=p:\drive_z | |
:: exclude these dirs from sync | |
set excluded_dirs=exclude1 exclude2 "exclude 3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/usr/bin/env python | |
""" | |
Prerequisites: | |
* python | |
* youtube-dl https://rg3.github.io/youtube-dl/ | |
* (not required yet) mutagen (pip install mutagen) |