Skip to content

Instantly share code, notes, and snippets.

@julianxhokaxhiu
julianxhokaxhiu / create-iso.sh
Last active March 25, 2024 16:15
Simple bash script to create a Bootable ISO from macOS Catalina Install Image from Mac App Store
#!/usr/bin/env bash
#===========================================================================
# Works only with the official image available in the Mac App Store.
# Make sure you download the official installer before running this script.
#===========================================================================
hdiutil create -o /tmp/Catalina.cdr -size 9000m -layout SPUD -fs HFS+J
hdiutil attach /tmp/Catalina.cdr.dmg -noverify -mountpoint /Volumes/install_build
sudo /Applications/Install\ macOS\ Catalina.app/Contents/Resources/createinstallmedia --volume /Volumes/install_build --nointeraction
hdiutil detach "/Volumes/Install macOS Catalina"
@shamil
shamil / mount_qcow2.md
Last active April 25, 2024 09:25
How to mount a qcow2 disk image

How to mount a qcow2 disk image

This is a quick guide to mounting a qcow2 disk images on your host server. This is useful to reset passwords, edit files, or recover something without the virtual machine running.

Step 1 - Enable NBD on the Host

modprobe nbd max_part=8
@mgedmin
mgedmin / show-all-256-colors.py
Last active August 24, 2023 16:23
Script to show all 256 colors supported by xterms
#!/usr/bin/python
"""Print a swatch using all 256 colors of 256-color-capable terminals."""
__author__ = "Marius Gedminas <marius@gedmin.as>"
__url__ = "https://gist.github.com/mgedmin/2762225"
__version__ = '2.0'
def hrun(start, width, padding=0):
@mfojtik
mfojtik / sample.rb
Created April 26, 2012 15:54
memcached sample
require 'dalli'
require 'redis'
require 'pp'
module Cache
def self.[](*keys)
if keys.size == 1
value = self.get(keys.first)
value.extend(CacheMethods) && value.__key__(keys.first)
@jrom
jrom / nginx.conf
Created February 7, 2012 17:14
nginx hack for multiple conditions
if ($request_uri = /) {
set $test A;
}
if ($host ~* teambox.com) {
set $test "${test}B";
}
if ($http_cookie !~* "auth_token") {
set $test "${test}C";
@gavinheavyside
gavinheavyside / trivial_file_upload_service.rb
Created November 3, 2009 20:09
Trivial file upload service using Sinatra
require 'rubygems'
require 'sinatra'
require 'fileutils'
# upload with:
# curl -v -F "data=@/path/to/filename" http://localhost:4567/user/filename
post '/:name/:filename' do
userdir = File.join("files", params[:name])