Hacking is really just the act of finding a clever and counterintuitive solution to a problem.
The hacks found in program exploits usually use the rules of the computer to bypass security in ways never intended. Programming hacks are similar in that they also use the rules of the computer in new and inventive ways, but the final goal is efficiency or smaller source code, not necessarily a security compromise. There are actually an infinite number of programs that can be written to accomplish any given task, but most of these solutions are unnecessarily large, complex, and sloppy. The few solutions that remain are small, efficient, and neat. Programs that have these qualities are said to have elegance, and the clever and inventive solutions that tend to lead to this efficiency are called hacks. Hackers on both sides of programming appreciate both the beauty of elegant code and the ingenuity of clever hacks.
In the business world, more importance is placed on churning out functional code than on
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from conans import ConanFile, CMake | |
| class MyProject(ConanFile): | |
| name = "my_project" | |
| version = "0.1" | |
| settings = "os", "compiler", "build_type", "arch" | |
| generators = "cmake" | |
| requires = [ | |
| "sandboxed-api/1.0.0", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // simplevm.c: demonstrates Hypervisor.Framework usage in Apple Silicon | |
| // Based on the work by @zhuowei | |
| // @imbushuo - Nov 2020 | |
| // To build: | |
| // Prepare the entitlement with BOTH com.apple.security.hypervisor and com.apple.vm.networking WHEN SIP IS OFF | |
| // Prepare the entitlement com.apple.security.hypervisor and NO com.apple.vm.networking WHEN SIP IS ON | |
| // ^ Per @never_released, tested on 11.0.1, idk why | |
| // clang -o simplevm -O2 -framework Hypervisor -mmacosx-version-min=11.0 simplevm.c | |
| // codesign --entitlements simplevm.entitlements --force -s - simplevm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # Set en0 to a random MAC address on macOS | |
| sudo /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -z | |
| openssl rand -hex 6 | sed 's!\.!!g;s!\(..\)!\1:!g;s!:$!!' | xargs -t -0 sudo ifconfig en0 lladdr | |
| sudo ifconfig en0 up |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Option Explicit | |
| Function INCOMENETTAU(ByVal gross As Double, Optional monthly = False) As Double | |
| ' (AU) Return the nett income after tax and Medicare Levy for the given gross income, optionally for a single month | |
| Dim tax As Double | |
| Dim medicareLevy As Double | |
| Dim nett As Double | |
| medicareLevy = gross * 0.02 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| iex "& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # Fork of zrzk's tot.sh https://gist.github.com/zrzka/5948256ac72c3f3820aebff1fb4b1b70 | |
| # which is a fork of gruber's tot.sh https://gist.github.com/gruber/b18d8b53385fa612713754799ed4d0a2 | |
| # which is a fork of chockenberry's tot.sh https://gist.github.com/chockenberry/d33ef5b6e6da4a3e4aa9b07b093d3c23 | |
| # Add possibility to access dots by default color names in addition to numbers and | |
| # access first empty dot by 'empty' in addition to 0. | |
| # Exit immediately if a pipeline returns a non-zero status. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| # Don't call directly, called by `subtitles.sh` | |
| """Given an srt file, clean it up as much as possible to look like prose.""" | |
| import re | |
| import sys | |
| bad_words = ['-->', 'WEBVTT', 'Language: en', 'Kind: captions'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env perl | |
| # known issues: | |
| # plenty, but | |
| # GitHub can't render it properly: see the raw version which is `perltidy` | |
| # hardcodes image size and only looks for gifs | |
| # has an iterator that goes over 9000 regardless of whether it's still | |
| # getting images or not | |
| # it was written for a particular Tumblr, so may need tweaking for others | |
| # | |
| # try: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # slow down crazy fast gaming mouse on X | |
| if [[ `uname` == 'Darwin' ]]; then | |
| echo "Exiting: I don't know what this does on macOS even with XQuartz." | |
| exit 1; | |
| fi | |
| FASTMOUSE=$(xinput --list --short|grep -i sabre|cut -f 2 |sed 's/id=//g') | |
| for id in ${FASTMOUSE[@]}; do | |
| xinput --set-prop $id "Device Accel Constant Deceleration" 10 | |
| xinput --set-prop $id "Device Accel Velocity Scaling" 10 |