Skip to content

Instantly share code, notes, and snippets.

View melonamin's full-sized avatar
🦄
magic

Alex Mazanov melonamin

🦄
magic
View GitHub Profile
@christian-oudard
christian-oudard / term_colors.py
Created October 28, 2009 14:54
Terminal output colors in python
from __future__ import print_function
"""
Utilities for 256 color support in terminals.
Adapted from:
http://stackoverflow.com/questions/1403353/256-color-terminal-library-for-ruby
The color palette is indexed as follows:
0-15: System colors
@saetia
saetia / gist:1623487
Last active January 6, 2025 20:03
Clean Install – OS X 10.11 El Capitan

OS X Preferences


most of these require logout/restart to take effect

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active February 2, 2025 02:04
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@brandonb927
brandonb927 / osx-for-hackers.sh
Last active January 28, 2025 07:20
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned.
#!/bin/sh
###
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer)
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos
###
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx
@mavc
mavc / json_parser.py
Created October 1, 2012 18:46
pyparsing and ply demonstration
import re
from ply import lex, yacc
from ply.lex import TOKEN
import pyparsing as pp
# First, let's define a pyparsing parser for JSON.
class JSONPyParsing(object):
# pylint: disable-msg=W0104,E0213
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active December 23, 2024 10:35
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@alghanmi
alghanmi / podcastgen.py
Last active July 29, 2024 07:43
Podcast Feed Generator -- Generate an podcast RSS feed for a set of media in a directory.
"""Podcast Feed Generator
Generate an podcast RSS feed for a set of media in a directory.
Use the list-extensions argument to see the list of supported extensions. You can add custom extensions using
Usage:
podcastgen.py gen <directory> --title=<podcast-title> --link=<podcast-link> --desc=<description> [--output=<rss-feed-file>] [--feed-link=<feed-url>] [--id=<podcast-id>] [--logo=<image_file>] [--category=<itunes-category> [--subcategory=<itunes-category>]] [--language=<language>] [--use-extension=<ext>]
podcastgen.py list-categories
podcastgen.py list-extensions
podcastgen.py -h | --help
import Foundation
import UIKit
// Usage Examples
let shadowColor = Color.shadow.value
let shadowColorWithAlpha = Color.shadow.withAlpha(0.5)
let customColorWithAlpha = Color.custom(hexString: "#123edd", alpha: 0.25).value
enum Color {
@smileyborg
smileyborg / SimulatedSlowLoadingImage.swift
Created August 5, 2017 02:06
Snippet showing how to create an NSItemProvider with a simulated delay for loading an image
import UIKit
import MobileCoreServices
let image = UIImage() // your actual image
let itemProvider = NSItemProvider()
itemProvider.registerDataRepresentation(forTypeIdentifier: kUTTypeJPEG as String, visibility: .all) { (completionBlock) -> Progress? in
let unitsOfWork = 10 + Int64(arc4random_uniform(UInt32(10))) // 10 - 19 units
let progress = Progress.discreteProgress(totalUnitCount: unitsOfWork)
@iGarym
iGarym / PEG-SQL
Created January 3, 2019 08:28
peg sql grammar
{
var SQL = {
listToString: function(x, xs) {
return [x].concat(xs).join("");
}
};
}
Start
= Stmt