Skip to content

Instantly share code, notes, and snippets.

@fworks
fworks / install-zsh-windows-git-bash.md
Last active April 19, 2024 19:52
Zsh / Oh-my-zsh on Windows Git Bash
@JakeWharton
JakeWharton / dex.sh
Last active March 25, 2024 13:54
`classes.dex` method count helpers. Requires smali/baksmali from https://code.google.com/p/smali/ and dexdump from the build-tools in the Android SDK be on your PATH.
function dex-method-count() {
cat $1 | head -c 92 | tail -c 4 | hexdump -e '1/4 "%d\n"'
}
function dex-method-count-by-package() {
dir=$(mktemp -d -t dex)
baksmali $1 -o $dir
for pkg in `find $dir/* -type d`; do
smali $pkg -o $pkg/classes.dex
count=$(dex-method-count $pkg/classes.dex)
name=$(echo ${pkg:(${#dir} + 1)} | tr '/' '.')
@premek
premek / mv.sh
Last active March 5, 2024 17:43
Rename files in linux / bash using mv command without typing the full name two times
# Put this function to your .bashrc file.
# Usage: mv oldfilename
# If you call mv without the second parameter it will prompt you to edit the filename on command line.
# Original mv is called when it's called with more than one argument.
# It's useful when you want to change just a few letters in a long name.
#
# Also see:
# - imv from renameutils
# - Ctrl-W Ctrl-Y Ctrl-Y (cut last word, paste, paste)
@zhuowei
zhuowei / fastboot_commands.txt
Last active September 21, 2023 07:59
Huawei Nexus 6P Angler fastboot commands
List grabbed from running `strings` on the bootloader; it's probably incomplete.
Most of these commands are untested, and all of them sound like they can seriously break your phone. Be careful.
Tested: (all on a bootloader unlocked device)
fastboot oem uart enable: changes "Console" on the bootloader screen to say "ttyHSL0,115200,n8";
probably enables serial messages; haven't checked since I don't know where the Nexus 6P's uart is
fastboot oem ramdump enable: changes "Download mode" on the bootloader screen to say "ENABLED" instead of "DISABLED".

Technical details for https://stackoverflow.com/a/44169445/6730571

Details of investigation:

On a base system, /usr/bin/java is a symlink that points to /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, which is an Apple wrapper tool that locates and executes the actual java.

(Do not touch anything in those 2 system directories. It should actually be impossible due to "System Integrity Protection" anyway.)

If you don't have Java installed, attempting to execute java will open a dialog that invites you to install it.

@markmur
markmur / .zshrc
Last active June 6, 2023 12:11
Add script to package.json via command line
# Reusable bash function you can add to your ~/.zshrc or ~/.bashrc file
#
# Usage: pkg-script start "node index.js"
#
function pkg-script () {
echo $(jq --arg key "${1}" --arg val "${2}" '.scripts[$key]=$val' package.json) | jq . | > package.json
}
@miguelfrde
miguelfrde / archinstall.md
Last active August 29, 2022 08:29
Preinstalled Windows 8.1 and Arch Linux dual boot

Arch Linux installation (preinstalled Windows 8.1 dual boot)

Before

  1. Disable Windows Fast-Startup
  2. Disable Secure Boot

Partitioning

#!/bin/bash
# Create Git Repository
# created by Jim Kubicek, 2009
# jimkubicek@gmail.com
# http://jimkubicek.com
# DESCRIPTION
# Create remote git repository from existing project
# this script needs to be run from within the project directory
@motleytech
motleytech / casper.md
Created June 21, 2016 01:00
Deal with casper

Unofficial Guide to JAMF Casper

This page documents the external/internal behavior of Casper.

Files

Casper installed itself into the following directories:

  • /Library/Application Support/JAMF
    • ManagementFrameworkScripts - a set of scripts that runs on certain events
      • StartupScript.sh - Activated when jamf is started
      • loginhook.sh - Activated when user login
  • logouthook.sh - Activated when user logout
@nvk
nvk / signing-gpg-keys.md
Created June 26, 2019 13:33 — forked from F21/signing-gpg-keys.md
Signing someone's GPG key

This is a quick guide of the commands we use to sign someone's GPG key in a virtual key signing party.

Note: The steps cover only the technical aspects of signing someone's key. Before signing someone's key, you must verify their identity. This is usually done by showing government-issued ID and confirming the key's fingerprint

The commands will work for both GPG and GPG2.

I use Julian's key for the examples. His key id is 2AD3FAE3. You should substitute with the appropriate key id when running the commands.

Signing the key

  1. List the keys currently in your keyring: gpg --list-keys.