Skip to content

Instantly share code, notes, and snippets.

@eddy-22
eddy-22 / ve.sh
Created May 2, 2018 01:29
Virtualenv wrapper
#!/bin/sh
#
# Copyright (c) 2016 Ming Qin (覃明) <https://github.com/QinMing>
# Open source under MIT LICENSE.
# You are more than welcome to come together and make this better.
ve() {
# Change path here, or add it as environment variable
if [ ! -n "$VENV_ROOT" ]; then
@eddy-22
eddy-22 / bynens.sh
Last active March 7, 2021 02:15
[MacOS Setup Scripts] Scripts that bootstrap sane defaults when setting up MacOS #macos
#!/usr/bin/env bash
# ~/.macos — https://mths.be/macos
# Original by Mathias Bynes
# Forked by Eddy Yousef
# Close any open System Preferences panes, to prevent them from overriding
# settings we’re about to change
osascript -e 'tell application "System Preferences" to quit'
@eddy-22
eddy-22 / wget.sh
Created August 23, 2020 16:48 — forked from crittermike/wget.sh
Download an entire website with wget, along with assets.
# One liner
wget --recursive --page-requisites --adjust-extension --span-hosts --convert-links --restrict-file-names=windows --domains yoursite.com --no-parent yoursite.com
# Explained
wget \
--recursive \ # Download the whole site.
--page-requisites \ # Get all assets/elements (CSS/JS/images).
--adjust-extension \ # Save files with .html on the end.
--span-hosts \ # Include necessary assets from offsite as well.
--convert-links \ # Update links to still work in the static version.
@eddy-22
eddy-22 / gitget.py
Created December 23, 2020 01:05 — forked from divs1210/gitget.py
Download a specific folder from a github repo
#!/usr/bin/python
"""
Download a specific folder from a github repo:
gitget.py https://github.com/divs1210/kilvish/tree/master/examples/bricksnball
"""
__author__ = 'Divyansh Prakash'
import sys
import subprocess
@eddy-22
eddy-22 / ve.sh
Last active June 14, 2021 02:15 — forked from erszk/ve.sh
[VE.sh] virtualenv wrapper in bash #virtualenv #shell
# -*- mode: sh -*-
# vim: syn=sh
# check to make sure virtualenv installed
if ! command which -s virtualenv; then
>&2 echo "You don't have virtualenv installed in your path. To install it:"
>&2 echo "pip install virtualenv"
return 1
fi
@eddy-22
eddy-22 / save-tabs.sh
Last active June 14, 2021 02:16
[Save Tabs Script] Saving tabs for later in an HTML file #shell
#!/usr/bin/env bash
save-tabs () {
local dest="${1:-$HOME/tabs.html}"
local SAVE_TABS=$(cat <<EOS
set text item delimiters to linefeed
tell application "Google Chrome" to set taburls to URL of tabs of window 1 as text
set urls to every text item of taburls
set filename to (choose file name with prompt "Save Tab Set" default name "tabs.html" default location path to desktop)
try
set tabfile to open for access file filename with write permission

Screen Quick Reference

Basic

Description Command
Start a new session with session name screen -S <session_name>
List running sessions / screens screen -ls
Attach to a running session screen -x
Attach to a running session with name screen -r

ZSH CheatSheet

This is a cheat sheet for how to perform various actions to ZSH, which can be tricky to find on the web as the syntax is not intuitive and it is generally not very well-documented.

Strings

Description Syntax
Get the length of a string ${#VARNAME}
Get a single character ${VARNAME[index]}
@eddy-22
eddy-22 / README.md
Created June 20, 2021 09:59
[Modern Alternatives To Unix Commands] Mostly written in Rust, much better performance. #cli #rust

Modern Unix

bat

A cat clone with syntax highlighting and Git integration.

tmux/tmuxinator cheatsheet

tmux

As configured in my dotfiles, here and here.

Command line

$ tmux                           -> start new
$ tmux new -s myname             -> start new w/session name
$ tmux a  #  (or at, or attach)  -> attach
$ tmux a -t myname               -> attach to named