Skip to content

Instantly share code, notes, and snippets.

View 166MMX's full-sized avatar

Johannes Harth 166MMX

View GitHub Profile
@timyates
timyates / hexdump.groovy
Last active December 30, 2015 00:19
Hexdump byte[] in Groovy via the metaClass
byte[].metaClass.hexdump { int idx, int len ->
println ''' +--------------------------------------------------+
| | 0 1 2 3 4 5 6 7 8 9 a b c d e f |
| +----------+--------------------------------------------------+------------------+'''.stripMargin()
delegate[ idx..<(idx+len) ].with { bfr ->
def bytes = bfr.collect { String.format( '%02x', it ) }
.collate( 8 )
.collate( 2 )
.collect { a, b -> ( a + [ '' ] + b ).join( ' ' ).padRight( 48, ' ' ) }
def ascii = bfr.collect { it > 0x1f && it < 0x7f ? (char)it : '.' }
@nolanlawson
nolanlawson / completion-for-gradle.md
Last active April 5, 2024 07:43
Gradle tab completion for Bash. Works on both Mac and Linux.

Gradle tab completion script for Bash

A tab completion script that works for Bash. Relies on the BSD md5 command on Mac and md5sum on Linux, so as long as you have one of those two commands, this should work.

Usage

$ gradle [TAB]
@natelandau
natelandau / .bash_profile
Last active June 13, 2024 18:01
Mac OSX Bash Profile
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
-480p - Run tenfoot in 480p rather than 1080p
-720p - Run tenfoot in 720p rather than 1080p
-accesscode -
-all_languages - show longest loc string from any language
-bigpicture - Start in Steam Big Picture mode
-blefw -
-cafeapplaunch - Launch apps in a cyber cafe context
-candidates - Show libjingle candidates for local connection as they are processed
-ccsyntax - Spew details about the localized strings we load
-cef-delaypageload - Enable early-out for known page loads
#!/bin/sh
in_place() {
content="$1"
file="$2"
id="$3"
range="/^#${id} START\$/,/^#${id} END\$/"
[ -f "$file" ] && [ -n "$(tail -c 1 "$file")" ] && echo >>"$file"
{ rm -- "$file" && sed "${range}d" >"$file"; } <"$file" && sed -n "${range}p" >>"$file" <"$content"
}
in_place "$0" "$HOME/.profile" 'Jump marks .profile'
@roadsideseb
roadsideseb / xvfb-run.sh
Last active June 15, 2019 20:41 — forked from tyleramos/xvfb-run.sh
XVFB Run Bash script
#!/bin/sh
# $Id: xvfb-run 2027 2004-11-16 14:54:16Z branden $
# This script starts an instance of Xvfb, the "fake" X server, runs a command
# with that server available, and kills the X server when done. The return
# value of the command becomes the return value of this script, except in cases
# where this script encounters an error.
#
# If anyone is using this to build a Debian package, make sure the package
@lukas-h
lukas-h / license-badges.md
Last active June 14, 2024 16:35
Markdown License Badges for your Project

Markdown License badges

Collection of License badges for your Project's README file.
This list includes the most common open source and open data licenses.
Easily copy and paste the code under the badges into your Markdown files.

Notes

  • The badges do not fully replace the license informations for your projects, they are only emblems for the README, that the user can see the License at first glance.

Translations: (No guarantee that the translations are up-to-date)

@GreyCat
GreyCat / c-struct-to-ksy.rb
Created March 25, 2017 10:53
Convert C struct into Kaitai Struct spec (.ksy)
#!/usr/bin/env ruby
require 'yaml'
TYPE_TO_KSY = {
'uint8_t' => 'u1',
'uint16_t' => 'u2',
'uint32_t' => 'u4',
'uint64_t' => 'u8',
@fbartho
fbartho / 0. Synology RAID Expansion-Resync Performance.md
Last active April 29, 2024 19:02
Walkthrough of what I did to increase performance on my Synology NAS box during an expansion, and afterwards.

Performance on Synology RAIDs

(especially while expanding)

Warning: The exact commands may not match for your particular linux OS / Synology(NAS) device. I had to customize the commands after exploring my particular system's setup.

If you're new to linux, or this is a new piece of hardware / a new synology device, jump down to the section called "Inspecting a setup"

Contents

@Bayonetta
Bayonetta / gist:bf699390e49bbc5f64262eb9aab61254
Created August 30, 2017 06:39
line_history_version.xml
<plist version="1.0">
<dict>
<key>pings</key>
<array />
<key>jingleDocType</key>
<string>purchaseSuccess</string>
<key>jingleAction</key>
<string>purchaseProduct</string>
<key>status</key>
<integer>0</integer>