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
ssh-keygen -E md5 -lf ~/.ssh/id_rsa.pub |
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
redis-server --daemonize yes |
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
psql.exe -U postgres -d balloon_development -f D:\temp\db.dump |
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
const checkboxes = document.querySelectorAll('input[type="checkbox"]'); | |
checkboxes.forEach(c => c.addEventListener('click', handleCheck)); | |
let lastChecked = null; | |
function handleCheck(e) { | |
let inBetween = false; | |
if(e.shiftKey && this !== lastChecked) { | |
checkboxes.forEach(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
// run the command in windows cmd | |
wslconfig /s Ubuntu | |
// to show list of installed subsystems | |
wslconfig /l |
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
if( true ) { | |
var ww = ( $(window).width() < window.screen.width ) ? $(window).width() : window.screen.width; //get proper width | |
var mw = 1024; | |
var ratio = ww / mw; | |
if( ww < mw){ | |
$('#viewport').attr('content', 'initial-scale=' + ratio + ', maximum-scale=' + ratio + ', minimum-scale=' + ratio + ', user-scalable=yes, width=' + ww); | |
}else{ | |
$('#viewport').attr('content', 'initial-scale=1.0, maximum-scale=2, minimum-scale=1.0, user-scalable=yes, width=' + ww); | |
} | |
} |
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
# regexp | |
# to create non-capturing group use: | |
(?:) | |
# (?:b) matches b without capturing it |
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
$('.carousel').each(function () { | |
var $carousel = $(this); | |
var hammertime = new Hammer(this, { | |
recognizers: [ | |
[Hammer.Swipe, { direction: Hammer.DIRECTION_HORIZONTAL }] | |
] | |
}); | |
hammertime.on('swipeleft', function () { | |
$carousel.carousel('next'); | |
}); |
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
# windows 10 goes into hibernation on shutdown. Turn it off in battery settings to make disks C & D writable | |
dd if=/dev/sdX bs=4K status=progress| gzip -c > /path/to/backup.img.gz |
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
def list_squared(m, n) | |
divs_hash = {} | |
(m..n).reduce([]) do |result, i| | |
sum = 1 | |
divs = [1] | |
for k in (2..i/2) | |
if (i % k).zero? | |
current = (i/k) | |
if divs_hash.has_key?(current.to_s) | |
divs_hash[current.to_s].each do |c| |
NewerOlder