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 | |
# This script sorts static libraries in the topological order suitable for | |
# passing to ld. No need for --start-group/--end-group anymore. Should speed | |
# up the linking a bit. When the libraries contain actual circular dependecies | |
# the script will detect minimal groups of those and surround them with | |
# --start-group/--end-group. | |
# | |
# To run you need Linux (maybe OS X), Ruby 1.9+ and the rgl gem installed: | |
# |
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 | |
min_width = `identify *.jpg` | |
.split("\n") | |
.map { |i| i[/JPEG (\d+x\d+)/, 1] } | |
.map { |i| i.split "x" } | |
.transpose[0] | |
.map { |i| i.to_i } | |
.min |
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 "rake" | |
require "colored" | |
abort "Usage: to-git hg-repo git-repo" if ARGV.size != 2 | |
SOURCE = ARGV[0] | |
DESTINATION = ARGV[1] | |
def hg params |
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/sh | |
arm-linux-gnueabi-g++ -o yo -static main.cpp | |
adb push yo /storage/sdcard0/Android/data/ | |
adb shell su -c "cd /storage/sdcard0/Android/data; cp yo /data/local/; rm yo; cd /data/local; chmod 751 yo; ./yo; rm yo" |
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
$ clang -c test.cpp; gcc -c test.cpp | |
test.cpp:10:7: error: read-only variable is not assignable | |
x = 0; | |
~ ^ | |
test.cpp:26:7: note: in instantiation of member function 'A<float>::f' requested here | |
a.f(0); | |
^ | |
1 error generated. |
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
Map without reserve | |
size: 0 | |
bucket_count: 23 | |
load_factor: 0 | |
Allocation count: 0 | |
size: 0 | |
bucket_count: 23 |
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/sh | |
ffmpeg -i input.mkv -c:v copy -c:a copy temporary-no-subtitles.mp4 | |
mp4box temporary-no-subtitles.mp4 -add subtitles-in-utf8.srt -out output.mp4 |
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
#include <iostream> | |
#include <string> | |
#include <boost/type_traits/has_less.hpp> | |
#define HAS_LESS(type) (boost::has_less<type>::value \ | |
? #type ": has less" \ | |
: #type ": doesn't have less") | |
#define CHECK(type) (std::cout << HAS_LESS(type) << "\n") |
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 | |
class Coord | |
attr_reader :x, :y | |
def initialize x, y | |
@x = x | |
@y = y | |
end |
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
#include <vector> | |
#include <limits> | |
#include <iostream> | |
struct Edge | |
{ | |
Edge(size_t to, int cost) | |
: to(to - 1) | |
, cost(cost) | |
{} |