mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-07-03 17:26:37 -04:00
code highlighting on older posts
This commit is contained in:
@ -27,22 +27,23 @@ My [full dotfiles are posted at this Git repository](https://git.jarv.is/jake/do
|
||||
* * *
|
||||
|
||||
|
||||
Check your current IP address (IPv4 or IPv6):
|
||||
Check your current IP address (IPv4 or IPv6 or both) — uses [my simpip server!](https://github.com/jakejarvis/simpip):
|
||||
|
||||
```
|
||||
alias ip4="dig +short myip.opendns.com A @resolver1.opendns.com"
|
||||
alias ip6="dig +short -6 myip.opendns.com AAAA @resolver1.ipv6-sandbox.opendns.com"
|
||||
```bash
|
||||
alias ip4="curl -4 simpip.com --max-time 1 --proto-default https --silent"
|
||||
alias ip6="curl -6 simpip.com --max-time 1 --proto-default https --silent"
|
||||
alias ip="ip4; ip6"
|
||||
```
|
||||
|
||||
Check your current local IP address:
|
||||
|
||||
```
|
||||
```bash
|
||||
alias iplocal="ipconfig getifaddr en0"
|
||||
```
|
||||
|
||||
Check, clear, set ([Google DNS](https://developers.google.com/speed/public-dns/) or [Cloudflare DNS](https://1.1.1.1/) or custom), and flush your computer's DNS, overriding your router:
|
||||
|
||||
```
|
||||
```bash
|
||||
alias dns-check="networksetup -setdnsservers Wi-Fi"
|
||||
alias dns-clear="networksetup -getdnsservers Wi-Fi"
|
||||
|
||||
@ -55,25 +56,25 @@ alias dns-flush="sudo killall -HUP mDNSResponder; sudo killall mDNSResponderHelp
|
||||
|
||||
Start a simple local web server in current directory:
|
||||
|
||||
```
|
||||
```bash
|
||||
alias serve="python -c 'import SimpleHTTPServer; SimpleHTTPServer.test()'"
|
||||
```
|
||||
|
||||
Test your internet connection's speed (uses 100MB of data):
|
||||
|
||||
```
|
||||
```bash
|
||||
alias speed="wget -O /dev/null http://cachefly.cachefly.net/100mb.test"
|
||||
```
|
||||
|
||||
Query DNS records of a domain:
|
||||
|
||||
```
|
||||
```bash
|
||||
alias digg="dig @8.8.8.8 +nocmd any +multiline +noall +answer" # example: digg google.com
|
||||
```
|
||||
|
||||
Make a new directory and change directories into it.
|
||||
|
||||
```
|
||||
```bash
|
||||
mkcdir() {
|
||||
mkdir -p -- "$1" &&
|
||||
cd -P -- "$1"
|
||||
@ -82,50 +83,50 @@ mkcdir() {
|
||||
|
||||
Unhide and rehide hidden files and folders on macOS:
|
||||
|
||||
```
|
||||
```bash
|
||||
alias unhide="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder"
|
||||
alias rehide="defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder"
|
||||
```
|
||||
|
||||
Force empty trash on macOS:
|
||||
|
||||
```
|
||||
```bash
|
||||
alias forcetrash="sudo rm -rf ~/.Trash /Volumes/*/.Trashes"
|
||||
```
|
||||
|
||||
Quickly lock your screen on macOS:
|
||||
|
||||
```
|
||||
```bash
|
||||
alias afk="/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend"
|
||||
```
|
||||
|
||||
Update Homebrew packages, global NPM packages, Ruby Gems, and macOS in all one swoop:
|
||||
|
||||
```
|
||||
```bash
|
||||
alias update="brew update; brew upgrade; brew cleanup; npm install npm -g; npm update -g; sudo gem update --system; sudo gem update; sudo gem cleanup; sudo softwareupdate -i -a;"
|
||||
```
|
||||
|
||||
Copy your public key to the clipboard:
|
||||
|
||||
```
|
||||
```bash
|
||||
alias pubkey="more ~/.ssh/id_rsa.pub | pbcopy | echo '=> Public key copied to pasteboard.'"
|
||||
```
|
||||
|
||||
Undo the most recent commit in current Git repo:
|
||||
|
||||
```
|
||||
```bash
|
||||
alias gundo="git push -f origin HEAD^:master"
|
||||
```
|
||||
|
||||
Un-quarantine an "unidentified developer's" application [blocked by Gatekeeper](https://support.apple.com/en-us/HT202491) on macOS's walled <del>prison</del> garden:
|
||||
|
||||
```
|
||||
```bash
|
||||
alias unq="sudo xattr -rd com.apple.quarantine"
|
||||
```
|
||||
|
||||
Quickly open a Bash prompt in a running Docker container:
|
||||
|
||||
```
|
||||
```bash
|
||||
docker-bash() {
|
||||
docker exec -ti $1 /bin/bash
|
||||
}
|
||||
@ -133,13 +134,13 @@ docker-bash() {
|
||||
|
||||
Pull updates for all Docker images with the tag "latest":
|
||||
|
||||
```
|
||||
```bash
|
||||
docker images --format "{{.Repository}}:{{.Tag}}" | grep :latest | xargs -L1 docker pull
|
||||
```
|
||||
|
||||
This odd hack is needed to run any of these aliases as sudo:
|
||||
|
||||
```
|
||||
```bash
|
||||
alias sudo="sudo "
|
||||
```
|
||||
|
||||
|
BIN
content/notes/dropping-dropbox/images/icloud-drive.png
Normal file
BIN
content/notes/dropping-dropbox/images/icloud-drive.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 271 KiB |
@ -39,9 +39,11 @@ Decisions made by the top folks at Dropbox gave me an increasingly sour taste in
|
||||
|
||||
The infamous [Apple Ecosystem™](https://medium.com/swlh/the-irresistible-lure-of-the-apple-ecosystem-81bf8d66294a) has held me firmly in its grasp for over a decade now, and the main requirement of a replacement cloud storage service for me was smooth interoperability between my MacBook, iPhone, and iPad.
|
||||
|
||||
{{< image src="images/icloud-storage.png" alt="iCloud Drive storage" >}}
|
||||
|
||||
I've never been a proponent of leaving all your eggs in one basket. But it's hard to ignore the convenience of Apple's streamlined (and [finally](https://www.imore.com/developers-encounter-major-icloud-issues-ios-13-beta) reliable) [**iCloud Drive**](https://www.apple.com/icloud/), which is already installed on all of my devices (and actually cheaper than Dropbox gigabyte-for-gigabyte, at $9.99/month for 2 TB). In fact, it's nearly invisible on macOS: I can simply save files in my Documents or Desktop folders as I always have and they're uploaded in the background. Git repositories now sync just fine and my files reappeared without a hitch after I recently formatted my Mac.
|
||||
|
||||
{{< image src="images/icloud-storage.png" alt="iCloud Drive storage" >}}
|
||||
{{< image src="images/icloud-drive.png" width="620" alt="iCloud Drive" >}}
|
||||
|
||||
I still use (and highly recommend) [**Backblaze**](https://www.backblaze.com/) ([referral link](https://secure.backblaze.com/r/00x84e)) to backup my home folder and add a second layer of redundancy to storing all of my most important files on ["someone else's computer."](https://www.zdnet.com/article/stop-saying-the-cloud-is-just-someone-elses-computer-because-its-not/) And as long as I remember to plug in my external SSD every so often, they're also backed up locally via [Time Machine](https://support.apple.com/en-us/HT201250).
|
||||
|
||||
|
@ -45,19 +45,19 @@ Conveniently, [Rapid7](https://www.rapid7.com/) publishes a monthly list for us
|
||||
|
||||
One of their free monthly datasets is called [Forward DNS](https://opendata.rapid7.com/sonar.fdns_v2/), where you'll find `.json` files named `xxxx-fdns_cname.json.gz`. Within the [`subtake`](https://github.com/jakejarvis/subtake) repository, there's an automated script named [`sonar.sh`](https://github.com/jakejarvis/subtake/blob/master/sonar.sh), which downloads the dataset for you and outputs a simple text file of CNAMEs pointed to any of the services listed above. Once you've [cloned the `subtake` repository](https://github.com/jakejarvis/subtake) and grabbed the timestamp part of the filename (the string that precedes `-fdns_cname.json.gz`), usage of the script is as follows:
|
||||
|
||||
```
|
||||
```bash
|
||||
./sonar.sh 2019-03-30-1553989414 sonar_output.txt
|
||||
```
|
||||
|
||||
This new text file contains *both active and abandoned* subdomains pointing to any of the services listed above -- we still need to narrow it down to the takeover candidates by attempting to actually resolve each of them, which is where `subtake` comes into play. To install `subtake`, make sure [Go is installed first](https://golang.org/doc/install#install) and run the following:
|
||||
|
||||
```
|
||||
```bash
|
||||
go get github.com/jakejarvis/subtake
|
||||
```
|
||||
|
||||
For a detailed description of the different options you can play around with, see the [full readme on GitHub](https://github.com/jakejarvis/subtake#usage) -- but here's a simple example command that uses 50 threads to take the CNAMEs listed in `sonar_output.txt` and outputs potentially vulnerable subdomains to `vulnerable.txt`.
|
||||
|
||||
```
|
||||
```bash
|
||||
subtake -f sonar_output.txt -c fingerprints.json -t 50 -ssl -a -o vulnerable.txt
|
||||
```
|
||||
|
||||
@ -65,7 +65,7 @@ This could take quite a while -- up to a day, depending on your CPU, memory, and
|
||||
|
||||
I also have a collection of root domains of companies offering bounties through [HackerOne](https://hackerone.com/directory/) or [Bugcrowd](https://bugcrowd.com/programs) at a [different GitHub repository](https://github.com/jakejarvis/bounty-domains/). Using the [`grep`-friendly text file](https://github.com/jakejarvis/bounty-domains/blob/master/grep.txt), it's easy to use [`grep`](http://man7.org/linux/man-pages/man1/grep.1.html) to narrow down your `vulnerable.txt` list even more:
|
||||
|
||||
```
|
||||
```bash
|
||||
grep -f grep.txt vulnerable.txt
|
||||
```
|
||||
|
||||
@ -111,4 +111,4 @@ No self-promotional links or redirects, no examples of XSS/cookie hijacking to b
|
||||
|
||||
I have several more [improvements](https://github.com/jakejarvis/subtake#to-do) I want to make to `subtake` (like integrating the `sonar.sh` script into the main Go executable, polishing the [all-in-one automated Docker image](https://hub.docker.com/r/jakejarvis/subtake), a self-updating list of service fingerprints, etc.) but still feel free to [make a suggestion](https://github.com/jakejarvis/subtake/issues) and/or contribute to the repository in the meantime.
|
||||
|
||||
Happy hunting, fellow penetrators! 😉
|
||||
Happy hunting, fellow penetrators! 😉
|
||||
|
@ -36,7 +36,7 @@ Assuming you're using GitHub, this step is easy. Just find the repository you're
|
||||
|
||||
GitHub will automatically redirect you to the forked repository under your username. This is the repository you need to clone to your local development environment, **not** the original. Grab the URL GitHub provides under the green "Clone or Download" button and plug it into the command below.
|
||||
|
||||
```
|
||||
```bash
|
||||
git clone git@github.com:jakejarvis/react-native.git
|
||||
```
|
||||
|
||||
@ -51,7 +51,7 @@ Switch directories to the forked repository you just cloned and run the followin
|
||||
|
||||
This links the fork back to the original repository as a remote, which we'll name `upstream`, and then fetch it.
|
||||
|
||||
```
|
||||
```bash
|
||||
git remote add --track master upstream git@github.com:facebook/react-native.git
|
||||
git fetch upstream
|
||||
```
|
||||
@ -61,7 +61,7 @@ git fetch upstream
|
||||
|
||||
It's possible to make changes directly to the `master` branch, but this might FUBAR things down the road for complicated reasons. It's best to [`checkout`](https://git-scm.com/docs/git-checkout) a new branch for **each** change/improvement you want to make. Replace `fix-readme-typo` with a more descriptive name for your changes, like `add-mobile-site` or `update-dependencies`.
|
||||
|
||||
```
|
||||
```bash
|
||||
git checkout -b fix-readme-typo upstream/master
|
||||
```
|
||||
|
||||
@ -75,14 +75,14 @@ This is either the easiest part or the hardest part, depending on how you look a
|
||||
|
||||
You're probably used to these commands. Add the files you've changed and commit them with a descriptive message.
|
||||
|
||||
```
|
||||
```bash
|
||||
git add .
|
||||
git commit -m "Fix grammar mistakes in the readme file"
|
||||
```
|
||||
|
||||
The one difference is the branch you're pushing to. You likely usually push to `master`, but in this case, we're pushing to the branch with the name you created in step 4.
|
||||
|
||||
```
|
||||
```bash
|
||||
git push -u origin fix-readme-typo
|
||||
```
|
||||
|
||||
|
@ -32,23 +32,40 @@ The "clean up" feature that VMware has developed for Windows guests can be appli
|
||||
|
||||
Once you're ready, here's how to shrink your Linux-based VM:
|
||||
|
||||
---
|
||||
|
||||
## Update (Dec. 30, 2018):
|
||||
|
||||
The open-source version of VMware Tools for Linux, [open-vm-tools](https://github.com/vmware/open-vm-tools), has added a simple command to automate the above steps in the latest version. Make sure you have the latest update through either apt or yum, and then run the following command in the **guest** terminal:
|
||||
|
||||
```bash
|
||||
vmware-toolbox-cmd disk shrink /
|
||||
```
|
||||
|
||||
Thank you to [commenter Susanna](https://jake.wordpress.com/2018/12/04/how-to-shrink-linux-virtual-disk-vmware/#comment-21) for pointing this out! The manual way below still works exactly the same.
|
||||
|
||||
---
|
||||
|
||||
## **Step 1:** Clean up time
|
||||
|
||||
Boot up your Linux virtual machine. We'll start by optimizing the OS as much as possible before shrinking it. In addition to manually deleting files you no longer use, running this command in your terminal can free up a little more space by removing some installation caches left behind by old versions of software you've installed and updated:
|
||||
|
||||
sudo apt-get clean
|
||||
```bash
|
||||
sudo apt-get clean
|
||||
```
|
||||
|
||||
|
||||
## **Step 2:** Make "empty" space actually empty
|
||||
|
||||
This step is the crucial one. In order for VMware to detect the newly free space, we need to free it up ourselves using a little trickery. We're going to have Linux overwrite the free space with a file full of zeros – the size of this file will be the size of however much space we're freeing up (5 GB, in the example above) – and then delete it. These commands will create the file, wait a moment, and then delete the file:
|
||||
|
||||
cat /dev/zero > zero.fill
|
||||
sync
|
||||
sleep 1
|
||||
sync
|
||||
rm -f zero.fill
|
||||
```bash
|
||||
cat /dev/zero > zero.fill
|
||||
sync
|
||||
sleep 1
|
||||
sync
|
||||
rm -f zero.fill
|
||||
```
|
||||
|
||||
Depending on how much space we're freeing, this could take a while. Let it finish or else you'll be left with an actual, real file that will occupy a ton of space – the opposite of what we're trying to accomplish!
|
||||
|
||||
@ -67,17 +84,23 @@ Now, we're going to run our final command in our **host** terminal, so open that
|
||||
|
||||
We're going to feed this command the exact location of the VMDK file we're shrinking. You can either do this by typing the **full path** to it, or by simply dragging the VMDK file onto the terminal after typing the first part of the command (up to and including "-d"). The "-d" argument will defragment the disk.
|
||||
|
||||
/Applications/VMware\ Fusion.app/Contents/Library/vmware-vdiskmanager -d <path to your .VMDK file>
|
||||
```bash
|
||||
/Applications/VMware\ Fusion.app/Contents/Library/vmware-vdiskmanager -d <path to your .VMDK file>
|
||||
```
|
||||
|
||||
The final command should look something like this, with your VMDK file instead:
|
||||
|
||||
/Applications/VMware\ Fusion.app/Contents/Library/vmware-vdiskmanager -d /Users/jake/Documents/Virtual\ Machines/Debian9.vmwarevm/Virtual\ Disk.vmdk
|
||||
```bash
|
||||
/Applications/VMware\ Fusion.app/Contents/Library/vmware-vdiskmanager -d /Users/jake/Documents/Virtual\ Machines/Debian9.vmwarevm/Virtual\ Disk.vmdk
|
||||
```
|
||||
|
||||
If you've done this correctly, you'll see it defragmenting the file, and then return "Defragmentation completed successfully." If it returns a different error, such as "This disk is read-only in the snapshot chain," it should tell you which disk you should actually shrink. Just run the command again with that VMDK file instead.
|
||||
|
||||
After the defragmentation completes, we need to finally shrink the image. We do this by running the same command as you did above, but replacing the "-d" with "-k" as follows:
|
||||
|
||||
/Applications/VMware\ Fusion.app/Contents/Library/vmware-vdiskmanager -k <path to the same .VMDK file>
|
||||
```bash
|
||||
/Applications/VMware\ Fusion.app/Contents/Library/vmware-vdiskmanager -k <path to the same .VMDK file>
|
||||
```
|
||||
|
||||
|
||||
## **Step 4:** Storage Profit!
|
||||
@ -85,14 +108,3 @@ After the defragmentation completes, we need to finally shrink the image. We do
|
||||
Obviously, this is a really annoying way to perform a feature that only takes one click to execute on Windows virtual machines. I don't recommend going through this entire process every time you delete a few random files. However, if you notice the free space on your host OS is mysteriously lower than it should be, the time this takes can be well worth it.
|
||||
|
||||
Let's hope this will be integrated in VMware Tools in the near future – feel free to [nudge VMware about it](https://my.vmware.com/group/vmware/get-help?p_p_id=getHelp_WAR_itsupport&p_p_lifecycle=0&_getHelp_WAR_itsupport_execution=e1s2) in the meantime!
|
||||
|
||||
|
||||
* * *
|
||||
|
||||
### Update (Dec. 30, 2018):
|
||||
|
||||
The open-source version of VMware Tools for Linux, [open-vm-tools](https://github.com/vmware/open-vm-tools), has added a simple command to automate the above steps in the latest version. Make sure you have the latest update through either apt or yum, and then run the following command in the **guest** terminal:
|
||||
|
||||
vmware-toolbox-cmd disk shrink /
|
||||
|
||||
Thank you to [commenter Susanna](https://jake.wordpress.com/2018/12/04/how-to-shrink-linux-virtual-disk-vmware/#comment-21) for pointing this out!
|
||||
|
Reference in New Issue
Block a user