This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env ruby | |
# lazy hack from Robert Klemme | |
module Memory | |
# sizes are guessed, I was too lazy to look | |
# them up and then they are also platform | |
# dependent | |
REF_SIZE = 4 # ? | |
OBJ_OVERHEAD = 4 # ? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
branches = `git branch`.strip.split("\n").map(&:strip).reject { |b| b.start_with?("*") } | |
branches.each_with_index do |branch, idx| | |
STDOUT.write("[#{idx + 1}/#{branches.size}] Delete '#{branch}' (y/n)? ") | |
answer = gets | |
if answer.strip =~ /[yY]/ | |
system("git branch -D #{branch}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unittest | |
def enum(obj): | |
if type(obj) == list: | |
return EnumList(obj) | |
elif type(obj) == dict: | |
return EnumDict(obj) | |
class Enumerable(object): | |
def each(self, cb): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
require "benchmark/ips" | |
require "allocation_stats" | |
require "/Users/camertron/workspace/camertron/vitesse/ext/vitesse/vitesse" | |
TIMES = 100 | |
actionview_trace = AllocationStats.trace do | |
output_buffer = ActionView::OutputBuffer.new |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Usage: gifify.sh <input file> <output file> | |
ffmpeg -i $1 -vf "fps=10,scale=320:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" $2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env ruby | |
require 'shellwords' | |
$cache = {} | |
def file_sizes_in(path) | |
$cache[path] ||= begin | |
raw = `du -d 1 2>/dev/null #{Shellwords.shellescape(path)}` | |
# exclude current dir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# First, install Xcode and accompanying command-line tools | |
wget https://cache.ruby-lang.org/pub/ruby/3.0/ruby-3.0.2.tar.gz | |
tar -zxvf ruby-3.0.2.tar.gz | |
cd ruby-3.0.2 | |
./configure --prefix=/tmp \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Single-threaded | |
┌───────┬─────────────────────┬──────────┬────────────────────────────────────────────┬────────┬───────────┬─────────┬───────────┬──────────┬──────┬───────────────┐ | |
│ Index │ Implementation │ Solution │ Label │ Passes │ Duration │ Threads │ Algorithm │ Faithful │ Bits │ Passes/Second │ | |
├───────┼─────────────────────┼──────────┼────────────────────────────────────────────┼────────┼───────────┼─────────┼───────────┼──────────┼──────┼───────────────┤ | |
│ 1 │ PrimeCPP │ 3 │ flo80_constexpr │ 37737 │ 5.00010 │ 1 │ base │ no │ 1 │ 7547.25207 │ | |
│ 2 │ PrimeCython │ 1 │ ssovest-cy │ 20838 │ 5.00015 │ 1 │ other │ yes │ 1 │ 4167.47164 │ | |
│ 3 │ PrimeC │ 2 │ danielspaangberg_5760of30030_owrb │ 20255 │ 5.00021 │ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
from datetime import (datetime, timedelta) | |
import os | |
import re | |
import subprocess | |
class Commit(object): | |
def __init__(self, commit_id, fields): | |
self.commit_id = commit_id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Crash Report log information -------------------------------------------- | |
See Crash Report log file under the one of following: | |
* ~/Library/Logs/DiagnosticReports | |
* /Library/Logs/DiagnosticReports | |
for more details. | |
Don't forget to include the above Crash Report log file in bug reports. | |
-- Control frame information ----------------------------------------------- | |
c:0001 p:0000 s:0003 E:001120 (none) [FINISH] |
NewerOlder