Skip to content

Instantly share code, notes, and snippets.

View kewlbear's full-sized avatar

Changbeom Ahn kewlbear

View GitHub Profile
@bkeating
bkeating / howto-filemerge-git-osx.md
Created March 11, 2010 21:36
HOWTO: Using FileMerge (opendiff) with Git on OSX

HOWTO: Using FileMerge (opendiff) with Git on OSX

FileMerge (opendiff) can really come in handy when you need to visually compare merging conflicts. Other times it's just a nice visual way to review your days work.

The following method works by creating a simple bash script (git-diff-cmd.sh) that sets us up with the proper command line arguments for Git to pass off files to FileMerge.

@briangriffey
briangriffey / NinePatchBitmapFactory.java
Last active April 25, 2023 03:06
Create 9-patches simlar to - (UIImage *)resizableImageWithCapInsets:(UIEdgeInsets)capInsets
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.NinePatch;
import android.graphics.Rect;
import android.graphics.drawable.NinePatchDrawable;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
/**
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active April 25, 2024 02:01
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

cmake_minimum_required(VERSION 2.8.4)
project(so29595222)
find_package(PythonLibs REQUIRED)
include_directories(${PYTHON_INCLUDE_DIRS})
ADD_DEFINITIONS( -std=c++11 )
set(SOURCE_FILES python_threading_example_so29595222.cpp)
@joshenders
joshenders / mitmproxy.md
Last active July 23, 2023 14:49
mitmproxy configuration for iPad

Successful mitmproxy-3.7 setup tested on OS X 10.13.6 and iPhone X running 12.1.4

Enable IP forwarding and disable ICMP redirects to keep the iPad sending traffic to the proxy

sudo sysctl -w net.inet.ip.forwarding=1
sudo sysctl -w net.inet.ip.redirect=0

net.inet.ip.forwarding
Enable IP forwarding between interfaces

@NSURLSession0
NSURLSession0 / cloudkit-server.php
Created February 7, 2016 21:36
CloudKit server-to-server in PHP
<?php
// Constants
$KEY_ID = 'YOUR_KEY_ID';
$CONTAINER = 'YOUR_CONTAINER';
$PRIVATE_PEM_LOCATION = 'eckey.pem'; // Store this file outside the public folder!
// Config
$url = 'https://api.apple-cloudkit.com/database/1/' . $CONTAINER . '/development/public/records/query';
$body = '{"query":{"recordType":"Articles"}}';
@TimOliver
TimOliver / libdsm-build-macos.sh
Last active March 28, 2019 04:00
A modified version of the libdsm build script for macOS
#!/bin/bash
# Global build settings
export SDKPATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
export MIN_MACOS_VERSION=10.10
export HOST=x86_64-apple-darwin
export LDFLAGS_NATIVE="-isysroot $SDKPATH"
export TASN1_CFLAGS="-Ilibtasn1/include"
export TASN1_LIBS="-Llibtasn1 -ltasn1"
export ARCH="x86_64"
@tclementdev
tclementdev / libdispatch-efficiency-tips.md
Last active April 26, 2024 10:15
Making efficient use of the libdispatch (GCD)

libdispatch efficiency tips

The libdispatch is one of the most misused API due to the way it was presented to us when it was introduced and for many years after that, and due to the confusing documentation and API. This page is a compilation of important things to know if you're going to use this library. Many references are available at the end of this document pointing to comments from Apple's very own libdispatch maintainer (Pierre Habouzit).

My take-aways are:

  • You should create very few, long-lived, well-defined queues. These queues should be seen as execution contexts in your program (gui, background work, ...) that benefit from executing in parallel. An important thing to note is that if these queues are all active at once, you will get as many threads running. In most apps, you probably do not need to create more than 3 or 4 queues.

  • Go serial first, and as you find performance bottle necks, measure why, and if concurrency helps, apply with care, always validating under system pressure. Reuse

pragma solidity ^0.4.23;
/// @title The Panmunjom Declaration for Peace, Prosperity and Unification of the Korean Peninsula
/// @author atomrigs
contract PanmunjomDeclaration {
string constant public content = "\xED\x95\x9C\xEB\xB0\x98\xEB\x8F\x84\xEC\x9D\x98\x20\xED\x8F\x89\xED\x99\x94\xEC\x99\x80\x20\xEB\xB2\x88\xEC\x98\x81\x2C\x20\xED\x86\xB5\xEC\x9D\xBC\xEC\x9D\x84\x20\xEC\x9C\x84\xED\x95\x9C\x20\xED\x8C\x90\xEB\xAC\xB8\xEC\xA0\x90\x20\xEC\x84\xA0\xEC\x96\xB8\x0A\x0A\xEB\x8C\x80\xED\x95\x9C\xEB\xAF\xBC\xEA\xB5\xAD\x20\xEB\xAC\xB8\xEC\x9E\xAC\xEC\x9D\xB8\x20\xEB\x8C\x80\xED\x86\xB5\xEB\xA0\xB9\xEA\xB3\xBC\x20\xEC\xA1\xB0\xEC\x84\xA0\xEB\xAF\xBC\xEC\xA3\xBC\xEC\xA3\xBC\xEC\x9D\x98\xEC\x9D\xB8\xEB\xAF\xBC\xEA\xB3\xB5\xED\x99\x94\xEA\xB5\xAD\x20\xEA\xB9\x80\xEC\xA0\x95\xEC\x9D\x80\x20\xEA\xB5\xAD\xEB\xAC\xB4\xEC\x9C\x84\xEC\x9B\x90\xEC\x9E\xA5\xEC\x9D\x80\x20\xED\x8F\x89\xED\x99\x94\xEC\x99\x80\x20\xEB\xB2\x88\xEC\x98\x81\x2C\x20\xED\x86\xB5\xEC\x9D\xBC\xEC\x9D\x84\x20\xEC\x97\xBC\xEC\x9B\x90\xED\x95\x98\x
@ccwasden
ccwasden / WithPopover.swift
Created February 5, 2020 13:39
Custom size popover in iOS SwiftUI
// -- Usage
struct Content: View {
@State var open = false
@State var popoverSize = CGSize(width: 300, height: 300)
var body: some View {
WithPopover(
showPopover: $open,
popoverSize: popoverSize,