Skip to content

Instantly share code, notes, and snippets.

View ttonyh's full-sized avatar

Tony Habash ttonyh

  • Los Angeles, CA
View GitHub Profile
@ttonyh
ttonyh / dabblet.css
Created May 12, 2013 17:13
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;
@ttonyh
ttonyh / parseUri.js
Created December 1, 2016 23:42
Simple Parse Uri function using HTMLAnchorElement
var uriNames = 'protocol hostname host pathname port search hash href origin'.split( ' ' );
var parseUri = function( url ) {
var Uri = function uri() {
var self = this,
setProp = function( nm, val ) {
if ( nm === 'search' ) {
val = ( String( val )[ 0 ] !== '?' ) ? '?' + val : val;
}
@ttonyh
ttonyh / install-node.sh
Last active October 17, 2021 15:32
Install Node
#!/bin/bash
# *** RUN AS ROOT ***
# Define help function
function help(){
echo "Node JS Install Script - Install Node JS";
echo "Usage example:";
echo "install-node (-v|--version) string [(-f|--force)] [(-p|--platform) string] [(-a|--arch) string]";
echo "Options:";
dockerstop () {
local ID=`docker ps -aqf name=$1`
if [ ! -z "$ID" ]
then
echo "STOPING/REMOVING CONTAINER: $ID ($1)..."
docker stop "$ID" && docker rm "$ID"
else
echo "CONTAINER '$1' NOT FOUND"
fi
@ttonyh
ttonyh / .aliases
Last active November 24, 2023 22:17 — forked from alekratz/.aliases
Pacman aliases
# Detailed ls list to less in color
if ls --color -d . >/dev/null 2>&1; then
# GNU
alias L="ls --color -l | less -r"
elif ls -G -d . >/dev/null 2>&1; then
# BSD
alias L="CLICOLOR_FORCE=1 ls -l | less -r"
fi
@ttonyh
ttonyh / images-google-to-bing.js
Last active February 15, 2020 19:16
Bookmarklet - Used while in Google Images, to transfer the current search to Bing Images (which currently has a better interface)
(function( p, u, q ) {
p = document.location.search.substr( 1 ).split( '&' );
u = 'https://www.bing.com/images/search?q=';
if ( p ) {
q = p.filter( a => String( a ).startsWith( 'q=' ) );
if ( q && q.length ) {
q = q[ 0 ].replace( 'q=', '' );
window.document.location = u + q;
@ttonyh
ttonyh / youtube-show-feed-list.js
Created February 15, 2020 19:16
Bookmarklet - Sets a Youtube Feet view to list mode
( ( w, d, s1, s2, b, cN ) => {
const GS = ( src, d ) => {
d = document;
return new Promise( ( resolve, reject ) => {
s = d.createElement( 'script' );
s.type = 'text/javascript';
s.async = true;
s.onload = () => resolve();
s.src = src;
d.getElementsByTagName( 'head' )[ 0 ].appendChild( s );
@ttonyh
ttonyh / delete-branches
Created May 16, 2020 17:20
Delete Branches
#!/bin/bash
# REF: https://github.com/JanisVepris/dot-files/blob/master/scripts/deleteBranches
COUNT=0
BRANCHES=( $(git branch | grep -e "^[^*].*") )
HEIGHT=30
WIDTH=80
CHOICE_HEIGHT=28
@ttonyh
ttonyh / youtube-show-list-view.js
Created August 30, 2020 22:31
Bookmarklet to show a YouTube page in list view
( ( w, l, lo, p, qp ) => {
l = window.location;
lo = new URL(l);
p = l.search;
qp = new URLSearchParams(p);
qp.append('disable_polymer', '1');
qp.append('flow', 'list');
lo.search = '?' + qp.toString();
@ttonyh
ttonyh / install-yay
Last active April 10, 2021 01:40 — forked from macchaberrycream/install_yay.bash
[install yay shell script] #ArchLinux
#!/usr/bin/env bash
# Assume JQ is already installed
if ! builtin type -p 'yay' >/dev/null 2>&1; then
echo 'Install yay.'
TMPDIR="$(mktemp -d)"
cd "${TMPDIR}" || return 1