Skip to content

Instantly share code, notes, and snippets.

@bketelsen
bketelsen / cloud-config.yaml
Last active November 27, 2018 10:08
Wait until ETCD Cluster is up and running before trying to do anything that might use ETCD
#cloud-config
---
write_files:
- path: /opt/bin/waiter.sh
owner: root
content: |
#! /usr/bin/bash
until curl http://127.0.0.1:4001/v2/machines; do sleep 2; done
coreos:
@jnovack
jnovack / README.md
Last active April 3, 2024 03:24
Opening up mosh in firewalld using firewall-cmd

Mosh (mobile shell) is a gift from the Gods(tm). Anyone with spotty internet or wireless connection has suffered the pain of a lost SSH session. Sure, one can fire up screen (or tmux as the kids are using these days), but that's an extra step and you are still using the SSH protocol.

I'm not here to tout the benefits of Mosh, you came here to open it up in your firewall.

  1. Create the following file as /etc/firewalld/services/mosh.xml
  2. firewall-cmd --add-service=mosh --permanent
  3. firewall-cmd --reload

If you tend to have a lot of sessions (not recommended), you can increase the ports, but the default should be fine for most applications.

@niw
niw / create_yosemite_bootable_disk.sh
Last active April 1, 2019 04:13
How to create a bootable install disk image from Install OS X 10.10 Developer Preview.app
# Since Contents/Resources/createinstallmedia command doesn't work, we need to manually create an disk image.
# Mount InstallESD.dmg
hdiutil mount /Applications/Install\ OS\ X\ 10.10\ Developer\ Preview.app/Contents/SharedSupport/InstallESD.dmg
# Create a temporary writable BaseSystem image.
hdiutil convert /Volumes/OS\ X\ Install\ ESD/BaseSystem.dmg -format UDRW -o rw.dmg
# Get required sectors for packages.
# You'll get these numbers.
@zhaoyk
zhaoyk / UIFont - CTFontRef 转换
Last active March 8, 2022 11:12
UIFont 与 CTFontRef 互相转换
+ (UIFont *)uifontFromCTFontRef:(CTFontRef)ctFont {
CGFloat pointSize = CTFontGetSize(ctFont);
NSString *fontPostScriptName = (NSString *)CFBridgingRelease(CTFontCopyPostScriptName(ctFont));
UIFont *fontFromCTFont = [UIFont fontWithName:fontPostScriptName size:pointSize];
return fontFromCTFont;
}
+ (CTFontRef)ctFontRefFromUIFont:(UIFont *)font {
CTFontRef ctfont = CTFontCreateWithName((__bridge CFStringRef)font.fontName, font.pointSize, NULL);
return CFAutorelease(ctfont);
@wbroek
wbroek / genymotionwithplay.txt
Last active February 12, 2024 03:22
Genymotion with Google Play Services for ARM
NOTE: Easier way is the X86 way, described on https://www.genymotion.com/help/desktop/faq/#google-play-services
Download the following ZIPs:
ARM Translation Installer v1.1 (http://www.mirrorcreator.com/files/0ZIO8PME/Genymotion-ARM-Translation_v1.1.zip_links)
Download the correct GApps for your Android version:
Google Apps for Android 6.0 (https://www.androidfilehost.com/?fid=24052804347835438 - benzo-gapps-M-20151011-signed-chroma-r3.zip)
Google Apps for Android 5.1 (https://www.androidfilehost.com/?fid=96042739161891406 - gapps-L-4-21-15.zip)
Google Apps for Android 5.0 (https://www.androidfilehost.com/?fid=95784891001614559 - gapps-lp-20141109-signed.zip)
@kishikawakatsumi
kishikawakatsumi / Rakefile
Last active August 29, 2015 13:56
Rakefile for testing, building and uploading to Testflight/Crittercism
require "rubygems/version"
require "rake/clean"
require "date"
require 'time'
require "json"
require "open3"
# Application info
APP_NAME = "Ubiregi2"
SDK = "iphoneos"
#!/usr/bin/env ruby
file = File.open("index.html", "r:iso-2022-jp:UTF-8")
content = file.read
all_html = <<HTML
<html>
<head>
<meta http-requiv="Content-Type" content="text/html;charset=utf-8">
<meta name="Author" content="Aoki Minero">
@bash0C7
bash0C7 / gist:5425124
Last active July 28, 2017 01:32
Twilio ワン切りサンプル
require 'twilio-ruby'
#twilio account
twilio_account_sid = 'XXXXXX'
auth_token = 'XXXXXX'
from_number = '+81XXXXX' #コール元(twilioの電話番号)
to_number = '+81XXXXX' #コール先
url = 'http://example.com' #通話を接続する時に使う完全修飾 URL です。 着信通話を処理するために、電話番号に URL をセットするのと同じです。 詳細は、後述の URL パラメーター のセクションを参照してください。 https://jp.twilio.com/docs/api/rest/making-calls
@shanselman
shanselman / gist:5422230
Last active March 28, 2024 10:33
Evil Blog Comment Spammer just exposed his template through some error and the whole thing showed up in my comments.
{
{I have|I've} been {surfing|browsing} online more than {three|3|2|4} hours today, yet I never found any interesting article like yours. {It's|It
is} pretty worth enough for me. {In my opinion|Personally|In my view}, if all {webmasters|site owners|website owners|web owners} and bloggers made good content as
you did, the {internet|net|web} will be {much more|a lot more}
useful than ever before.|
I {couldn't|could not} {resist|refrain from} commenting. {Very well|Perfectly|Well|Exceptionally well} written!|
{I will|I'll} {right away|immediately} {take hold of|grab|clutch|grasp|seize|snatch}
your {rss|rss feed} as I {can not|can't} {in finding|find|to find} your {email|e-mail} subscription {link|hyperlink} or {newsletter|e-newsletter} service. Do {you have|you've} any?
{Please|Kindly} {allow|permit|let} me {realize|recognize|understand|recognise|know} {so that|in order that} I {may just|may|could} subscribe.
Thanks.|

msgpackの変更案について-3

概要:

  • 現行のRaw型をString型として読み替える。
    • 現行の FixRaw, raw 16, raw 32 は、FixString, string 16, string 32 になる
  • Binary型を新設する。
  • バイト列はBinary型で保存する。そうでなければString型で保存する。

背景