Skip to content

Instantly share code, notes, and snippets.

@allexradu
allexradu / setup.md
Last active March 28, 2024 20:02 — forked from novemberborn/setup.md
OS X Setup virtual hosts on two different ports

Changes with .dev domains in mind.

Step 1 : Assign at least two IP address to your MAC OS (one per domain), let's say :

192.168.0.51
192.168.0.52

To setup the second IP you will have to add a second Ethernet Adapter (logical not physical).

@nneonneo
nneonneo / youtube-dl.py
Last active April 2, 2024 04:57
YouTube-DL for Pythonista - download YouTube videos on your iPhone/iPad!
#!python3
'''
Directions:
- install yt-dlp via Pip (e.g. using (StaSh)[https://github.com/ywangd/stash] - `pip install yt-dlp`)
- add this script as a Share extension through Settings -> Share Extension Shortcuts
- while watching a video in the YouTube site or app, just share the video to Pythonista and select this script
- the video will download, and when it's done you can share the video file itself with any app (e.g. VLC)
Advanced usage:
@mauriciopazpp
mauriciopazpp / bash_terminal_colors.txt
Last active December 24, 2022 12:26
Bash terminal echo colors
An example is
Code:
echo "\033[1;31m Hello \033[0m"
The '31' and the '1' are the things you change. The '31' is the color code, and the '1' is where you put whatever you want to color. The rest of it is the same for every color coding; the beginning starts coloring, and the stuff afterwards stops coloring ('0' switches it back to default text color). You can use the following color codes:
Code:
30 - black
@fnky
fnky / ANSI.md
Last active May 10, 2024 15:31
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@docPhil99
docPhil99 / macFFmpeg.md
Last active April 30, 2024 20:43
Mac webcam FFmpeg

#Capture and stream a webcam To capture using the iSight camera on a Mac, or infact any other webcam connected to the Mac, we can use FFmpeg. First get a list of the devices installed.

ffmpeg -f avfoundation -list_devices true -i "" 

This will list the aviable video and audio devices.

The below will capture at 30fps and the set video size to a file. ffmpeg -f avfoundation -framerate 30 -video_size 640x480 -i "0:none" out.avi

@Paradoxis
Paradoxis / agressive-url-encode.md
Last active February 10, 2024 23:00
Agressive URL encode

Agressive URL encode

Python based CLI tool to agressively url-encode strings, rather than just encoding non-url characters this tool will encode every character in the URL.

Usage:

Firstly make a function in your .bash_profile to call the script

function url-encode()
{
 python ~//url_encode.py $@
@SidIcarus
SidIcarus / bootstrap.sh
Last active November 24, 2021 00:40
environment bootstrap scripts
#!/bin/bash
# shellcheck disable=1090,1091,2059
# set ENV default value to 'dev''
ENV="${1:-dev}"
# import (source) utility variables and functions
. "$DIR/bootstrap/utils"
# Terminal output to illustrate progress
@cuschk
cuschk / filename.sh
Created July 8, 2016 11:30
Bash: file base name and extension
#!/usr/bin/env bash
f='/path/to/example.txt'
base="${f##*/}"
echo $base
#=> example.txt
echo "${base%.*}"
@cvan
cvan / HOWTO.md
Last active April 15, 2024 04:01
get all URLs of all network requests made on a web page from the Chrome Dev Tools (from an exported HAR)

Setup

Using Homebrew on Mac OS X:

brew install jq

Add these aliases to your profile (e.g., ~/.zshrc, ~/.bashrc, ~/.profile, etc.):

alias hurlp='pbpaste | jq ".log.entries" | tee >(jq --raw-output "[.[] | .request.url] | sort | unique | .[]")'

alias hurld='pbpaste | jq ".log.entries" | jq --raw-output "[.[] | .request.url] | sort | unique | .[]" | harurls | tee >(xargs -n 1 curl -O $1)'

@cuschk
cuschk / filename.zsh
Last active July 15, 2022 05:47
Zsh: file base name and extension
#!/usr/bin/env zsh
f='example.txt'
echo ${f:r}
#=> example
echo ${f:e}
#=> txt