Skip to content

Instantly share code, notes, and snippets.

View kidsil's full-sized avatar

Asaf Zamir kidsil

View GitHub Profile
@kidsil
kidsil / taskwarrior_shorthands.md
Last active May 5, 2020 14:43
Taskwarrior Shorthands

These are shorthands for Taskwarrior I found so far. Make sure to install the Taskwarrior plugin for zsh

  • t -> task
  • pro: -> project:
  • act -> active (e.g. t act -> task active)
  • mod -> modify
@kidsil
kidsil / deploy.sh
Created April 22, 2020 09:19
Deploy a website to S3 with AWS CLI (one line)
aws s3 cp FOLDER_NAME_OR_DOT s3://BUCKET_NAME --profile OPTIONAL_AWS_PROFILE --recursive --acl public-read
@kidsil
kidsil / flatten.js
Created December 3, 2018 10:52
Flatten Multidimensional Arrays
'use strict';
const arr = [1,[2],[[3]],[[[4]]]]; //example Array
//Solution one - classic
let flatArr = [];
const flatten = (elem) => {
if (Array.isArray(elem)) return elem.forEach(flatten);
return flatArr.push(elem);
};
@kidsil
kidsil / readme.md
Last active February 23, 2021 15:23
Script to control the Volume of a USB headset

Script to control the Volume of a USB headset, can connect to shortcuts.

sh volumeChange.sh up sh volumeChange.sh down

@kidsil
kidsil / .htaccess
Created May 14, 2018 10:54
Block uploaded PHP files
<Files *.php>
deny from all
</Files>
@kidsil
kidsil / jquerify.js
Created May 1, 2018 10:09
jQuerify page script
!function(){if(!window.jQuery){var e=document.createElement("script");e.setAttribute("src","//ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"),document.body.appendChild(e)}}();
@kidsil
kidsil / script.sh
Created February 16, 2018 19:05
Convert PNGs to a single PDF (sorted by creation date [ascending])
ls *.png -tr | tr '\n' ' ' | sed 's/$/\ output_file.pdf/' | xargs convert
@kidsil
kidsil / validate.sh
Last active January 23, 2018 16:31 — forked from hrwgc/validate.sh
bash wget - check if file exists at url before downloading
#!/bin/bash
# simple function to check http response code before downloading a remote file
# example usage:
# if `validate_url $url >/dev/null`; then dosomething; else echo "does not exist"; fi
function validate_url(){
if [[ `wget -S --spider $1 2>&1 | grep 'HTTP/1.1 200 OK'` ]]; then echo "true"; fi
}
@kidsil
kidsil / spotify_web_player.js
Created May 17, 2017 10:51
Spotify Web Player - update tab title according to the currently playing song
document.querySelector('.track-info').addEventListener('DOMSubtreeModified',function(){
document.title = document.querySelector('.track-info__artists').textContent + ' - ' + document.querySelector('.track-info__name').textContent;
});
@kidsil
kidsil / hidpi_edp1_hdmi1_layout_solution.sh
Created April 24, 2017 10:36
HiDpi Monitor with external HDMI Monitor xrandr setup
#!/bin/sh
xrandr --output HDMI1 --scale 2x2 --mode 1920x1080 --fb 3840x2160 --pos 3040x0 --rotate normal --primary
xrandr --output eDP1 --scale 1x1 --pos -980x0