Skip to content

Instantly share code, notes, and snippets.

View andxyz's full-sized avatar
:octocat:

Andrew Stevens andxyz

:octocat:
View GitHub Profile
@chrisroos
chrisroos / README.md
Last active June 5, 2025 19:18
Example of using bundler/inline

I came across 'bundler/inline' in Bundler pull request 3440, which I'd found from Rails pull request 20429. This now has a little snippet on the What's new page of the Bundler site.

This little example demonstrates how I might use it to create a single file using minitest.

I've just noticed that this script was working for me because I already had minitest installed as a system gem. If I uninstall the gem then the script fails because it can't find minitest. The source code documents an option to install gems if they don't exist (gemfile(true) do) but that doesn't seem to work for me. I see the following error:

Fetching gem metadata from https://rubygems.org/...
Fetching version metadata from https://rubygems.org/..
Resolving dependencies...

Using metaclass 0.0.4

RSpec::Matchers.define :exceed_query_limit do |expected|
supports_block_expectations
match do |block|
query_count(&block) > expected
end
failure_message_when_negated do |actual|
"Expected a maximum of #{expected} queries, got #{@recorder.count}:\n\n#{@recorder.log_message}"
end
@mgrebenets
mgrebenets / share-schemes.rb
Created June 8, 2015 12:04
Share Xcode Schemes
#!/usr/bin/env ruby
# share_schemes.rb
require 'optparse'
require 'ostruct'
require 'rubygems'
require 'xcodeproj'
require 'colorize'
require 'fileutils'
@zhiguangwang
zhiguangwang / openssl.md
Last active May 17, 2025 08:10
Common OpenSSL Commands with Keys and Certificates

Common OpenSSL Commands with Keys and Certificates

Generate RSA private key (2048 bit)

openssl genrsa -out private.pem 2048

Generate a Certificate Signing Request (CSR)

openssl req -sha256 -new -key private.pem -out csr.pem
@non
non / answer.md
Last active February 28, 2025 11:46
answer @nuttycom

What is the appeal of dynamically-typed languages?

Kris Nuttycombe asks:

I genuinely wish I understood the appeal of unityped languages better. Can someone who really knows both well-typed and unityped explain?

I think the terms well-typed and unityped are a bit of question-begging here (you might as well say good-typed versus bad-typed), so instead I will say statically-typed and dynamically-typed.

I'm going to approach this article using Scala to stand-in for static typing and Python for dynamic typing. I feel like I am credibly proficient both languages: I don't currently write a lot of Python, but I still have affection for the language, and have probably written hundreds of thousands of lines of Python code over the years.

@dotzero
dotzero / clouddown.py
Last active October 3, 2022 03:26
Download all files from CloudApp
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import time
import json
import urllib
import urllib2
from dateutil.parser import parse
@marcocarnazzo
marcocarnazzo / 030_update_platform_config.js
Last active May 31, 2019 15:31
Ionic/Cordova update platform config
#!/usr/bin/env node
/** This hook updates platform configuration files based on preferences and config-file data defined in config.xml.
Currently only the AndroidManifest.xml and IOS *-Info.plist file are supported.
See http://stackoverflow.com/questions/28198983/ionic-cordova-add-intent-filter-using-config-xml
Preferences:
1. Preferences defined outside of the platform element will apply to all platforms
2. Preferences defined inside a platform element will apply only to the specified platform
@rtomayko
rtomayko / gem-apply
Created February 13, 2015 04:10
Apply a patch to a bundle installed gem (not for the faint of heart)
#!/bin/sh
#/ Usage: gem-apply <gem> <patchfile
#/ Apply a patch to a locally installed gem.
#/
#/ Example:
#/ % curl https://github.com/jekyll/jekyll/pull/3452.patch | gem-apply jekyll
#/ patching file lib/jekyll/commands/serve.rb
#/ Hunk #1 succeeded at 39 (offset -1 lines).
#/ Hunk #2 succeeded at 125 (offset -6 lines).
#/ patching file lib/jekyll/commands/serve.rb
@lrytz
lrytz / z-automator.png
Last active October 15, 2024 06:31
Shortcut for Syntax Highlighting in Keynote
@jkreps
jkreps / benchmark-commands.txt
Last active July 28, 2025 07:14
Kafka Benchmark Commands
Producer
Setup
bin/kafka-topics.sh --zookeeper esv4-hcl197.grid.linkedin.com:2181 --create --topic test-rep-one --partitions 6 --replication-factor 1
bin/kafka-topics.sh --zookeeper esv4-hcl197.grid.linkedin.com:2181 --create --topic test --partitions 6 --replication-factor 3
Single thread, no replication
bin/kafka-run-class.sh org.apache.kafka.clients.tools.ProducerPerformance test7 50000000 100 -1 acks=1 bootstrap.servers=esv4-hcl198.grid.linkedin.com:9092 buffer.memory=67108864 batch.size=8196