Skip to content
import psutil
import re
for process in psutil.process_iter():
try:
# match against a proctitle. will raise an exception if you can't query
# the process' cmdline which is caught below
if len(process.cmdline) and re.match("MY PROCTITLE", process.cmdline[0]):
# add up cpu usage
cpu_usage = 0.0
def extract_components(filename)
segments = filename.split(" ")
last_segment, *extensions = segments.pop.split(".")
basename = (segments << last_segment).join(" ")
[basename, extensions]
end
extract_components("a.b c.a")
# => ["a.b c", ["a"]]
read_pipe, write_pipe = IO.pipe
input_file = File.open("input_video.mp4", "r")
output_file = File.open("output_video.mp4", "w")
Thread.new do
loop do
begin
write_pipe.write(input_file.read_nonblock(1024))
rescue EOFError => e
write_pipe.close
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2260182/87abace383ef4321d6e9174c29105f66300331d7/hack.sh | sh
#
api_concern :public_browser_base do |t|
t.add :id
t.add :title
end
api_accessible :v1_public_browser do |t|
t.concern :public_browser_base
t.add :current_state
t.add :start_date_unixtime
end
echo;echo;echo
echo "YOUR MACHINE WAS JUST OWNED. OR IT WOULD BE, IF I WANTED IT TO BE. IMPLICIT TRUST IS A BAD THING."
echo;echo;echo
# If you insert a column using a timestamp that is before the current value's
# timestamp, your insert will be rejected. The timestamps come from the client
# not the server unless you're using CQL (apparently).
require 'rubygems'
require 'cassandra-cql'
require 'cassandra/1.0'
# Freezes time so we can mock it out for the duration of a block
require 'timecop'
# The data.
array_of_hashes = [{:foo => "bar"},
{:foo => "baz"},
{:foo => "quux"}]
# The problem: how to get the values of each key :foo.
# The way we do it now. In a chain of methods this looks rather
# busy and takes up a lot of room with ceremony. '|h|' and 'h' are
# not needed, and in the case of longer variable names they become
diff --git a/benchmarks/uuid.rb b/benchmarks/uuid.rb
index a256a6d..5032bb2 100644
--- a/benchmarks/uuid.rb
+++ b/benchmarks/uuid.rb
@@ -5,6 +5,8 @@ require 'bundler/setup'
require 'celluloid'
require 'benchmark/ips'
+ROFLSCALE = 1000
+
#!/bin/bash
# Expects the directory structure:
# .
# └── projectname
# ├── build.sh
# └── src
# ├── custompackage
# │   └── custompackage.go
# └── main
Something went wrong with that request. Please try again.