git format-patch -1 <sha>
OR
git format-patch -1 HEAD
git apply --stat file.patch # show stats.
git apply --check file.patch # check for error before applying
| import asyncio | |
| import aiohttp | |
| import time | |
| async def gather_with_concurrency(n, *tasks): | |
| semaphore = asyncio.Semaphore(n) | |
| async def sem_task(task): | |
| async with semaphore: |
| # Useful to prevent Macbooks to go to sleep when closing the lid instead of running tools that requires a Kernel Extension (e.g. InsomniaX) and more | |
| sudo pmset -a sleep 0; sudo pmset -a hibernatemode 0; sudo pmset -a disablesleep 1; | |
| # And to go back to normal (for Macbook): | |
| sudo pmset -a sleep 1; sudo pmset -a hibernatemode 3; sudo pmset -a disablesleep 0; | |
| # If you have desktop, to go back to normal run this: sudo pmset -a sleep 1; sudo pmset -a hibernatemode 25; sudo pmset -a disablesleep 0; |
| // This will open up a prompt for text to send to a console session on digital ocean | |
| // Useful for long passwords | |
| (function () { | |
| var t = prompt("Enter text to be sent to console, (This wont send the enter keystroke)").split(""); | |
| function f() { | |
| var character = t.shift(); | |
| var i=[]; | |
| var code = character.charCodeAt(); | |
| var needs_shift = "!@#$%^&*()_+{}:\"<>?~|".indexOf(character) !== -1 |
brew install fish
curl -L https://get.oh-my.fish | fish| import java.awt.Desktop; | |
| import java.io.BufferedReader; | |
| import java.io.IOException; | |
| import java.io.InputStream; | |
| import java.io.InputStreamReader; | |
| import java.net.URISyntaxException; | |
| import java.net.URL; | |
| import java.nio.charset.StandardCharsets; | |
| import java.util.HashMap; |
| import java.io.BufferedWriter; | |
| import java.io.File; | |
| import java.io.FileNotFoundException; | |
| import java.io.IOException; | |
| import java.io.OutputStream; | |
| import java.io.OutputStreamWriter; | |
| import java.io.PipedInputStream; | |
| import java.io.PipedOutputStream; | |
| import java.nio.ByteBuffer; | |
| import java.nio.ByteOrder; |