Skip to content

Instantly share code, notes, and snippets.

View msonnabaum's full-sized avatar

Mark Sonnabaum msonnabaum

  • Lithic
  • San Diego, CA
View GitHub Profile

Keybase proof

I hereby claim:

  • I am msonnabaum on github.
  • I am msonnabaum (https://keybase.io/msonnabaum) on keybase.
  • I have a public key ASAglXeQJzr-CGEUgFL8hJIrd_NFs5TFViA2uHH9i5s7wQo

To claim this, I am signing this object:

// Download the twitter4j jar:
// wget http://twitter4j.org/maven2/org/twitter4j/twitter4j-core/4.0.4/twitter4j-core-4.0.4.jar
// Fill out the key/token/secrets
// Run the script
// kotlinc -script -classpath ./twitter4j-core-4.0.4.jar who_posts_the_most.kts|sort -n
import twitter4j.Status
import twitter4j.Twitter
import twitter4j.TwitterException
import twitter4j.TwitterFactory
#!/usr/bin/env ruby
require "optparse"
options = {}
OptionParser.new do |opts|
opts.banner = "Usage: #{File.basename __FILE__} [options]"
opts.on "-p", "--process-names [process names]", "Process names to filter" do |v|
options[:process_names] = v.split(",")
end
end.parse!
@msonnabaum
msonnabaum / gist:1306569
Created October 22, 2011 22:28
install xhprof on mamp for php 5.3
wget http://pecl.php.net/get/xhprof-0.9.2.tgz
tar -xzf xhprof-0.9.2.tgz
cd xhprof-0.9.2/extension
/Applications/MAMP/bin/php/php5.3.6/bin/phpize
./configure
make
cp modules/xhprof.so $(/Applications/MAMP/bin/php/php5.3.6/bin/php-config --extension-dir)/
echo "extension=xhprof.so" >> /Applications/MAMP/bin/php/php5.3.6/conf/php.ini
<?php
require './core/vendor/autoload.php';
use Symfony\Component\Yaml\Parser;
function quantile($values, $p) {
sort($values);
$H = (count($values) - 1) * $p + 1;
$h = floor($H);
$v = $values[$h - 1];
node.set.elasticsearch.plugins = {
"mobz/elasticsearch-head" => {},
"lukas-vlcek/bigdesk" => {},
"royrusso/elasticsearch-HQ" => {}
}
<?php
class ContentEntityFormController extends EntityFormController {
public function getFormLangcode(array &$form_state) {
if (empty($form_state['langcode'])) {
$form_state['langcode'] = $this->entityManager()->getTranslationFromContext($this->entity)->language()->id;
}
return $form_state['langcode'];
#!/usr/bin/env ruby
require 'fileutils'
require 'shellwords'
def php_file_contents(filename)
open(filename).to_a
end
def fix_entity_paths(file_contents)
file_contents.map do |line|
<?php
xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY);
register_shutdown_function(function () {
$namespace = 'sitename';
$filename = '/tmp/' . uniqid() . '.' . $namespace . '.xhprof';
file_put_contents($filename, serialize(xhprof_disable()));
});
name: Bartik
type: theme
description: 'A flexible, recolorable theme with many regions and a responsive, mobile-first layout.'
package: Core
version: VERSION
core: 8.x
stylesheets:
all:
- css/layout.css
- css/style.css