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
def jpeg_size(path) do | |
bin = File.read!(WPI.Database.Media.complete_path(path)) | |
case jpeg_size(path, bin, {}) do | |
{} -> nil | |
size -> size | |
end | |
end | |
def jpeg_size(path, << 255, 192, 0, 17, 8, height::size(16), width::size(16), rest::binary >>, size) do | |
if {width, height} > size do |
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
# Assumptions: | |
# You want to merge the files from at least two folders. | |
# There is one directory you consider as the destination folder, in which you one to merge all other folder. | |
# Compute and save md5 hashes | |
find $thruth_folder -type f -print0 | xargs -0 -L 1 md5sum | tee hashes.1 | |
find $folder1 -type f -print0 | xargs -0 -L 1 md5sum | tee hashes.2 | |
# ... | |
# Do that for all the folders you want. Important, make sure all $folders are different, | |
# that will ensure all files have a different prefix on which we can match later. |
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 | |
# pip install percol | |
# pip install prompter | |
movie=$1 | |
ok=false | |
while [ $ok = false ]; do | |
torrentId=$(t411 -l 40 search -c filmvideo/film "$movie" size | percol | awk '{ print $1}') |
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
==> Making package: ib-tws 954.2s-2 (Tue Feb 16 04:30:50 UTC 2016) | |
==> Checking runtime dependencies... | |
==> Checking buildtime dependencies... | |
==> Retrieving sources... | |
-> Found LICENSE | |
-> Found ib-tws | |
-> Found ib-tws.desktop | |
-> Found ib-gw | |
-> Found ib-gw.desktop | |
-> Downloading tws-latest-standalone-linux-x64.sh... |
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 | |
# Thanks to this post: | |
# http://blog.ikato.com/post/15675823000/how-to-install-consolas-font-on-mac-os-x | |
brew install cabextract | |
cd ~/Downloads | |
mkdir consolas | |
cd consolas | |
curl -O http://download.microsoft.com/download/f/5/a/f5a3df76-d856-4a61-a6bd-722f52a5be26/PowerPointViewer.exe | |
cabextract PowerPointViewer.exe |
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 python | |
""" | |
Taken from http://www.stavros.io/posts/python-fuse-filesystem/ | |
""" | |
from __future__ import with_statement | |
import os | |
import sys |
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 Haskakafka | |
import qualified Data.ByteString.Char8 as C8 | |
kafkaConfig = [] | |
topicConfig = [] | |
host = "localhost:9092" | |
topic = "ttp" | |
partition = 0 | |
timeoutMs = 1000 |
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
def __getattr__(self, key): | |
- return self.find(key) | |
+ for i in self.data: | |
+ if key in i._identifiers: | |
+ return i | |
def __getattr__(self, key): | |
- if key.endswith("_") and key[:-1] in self._all_my_keys(): | |
- return getattr(self, key[:-1]) | |
- |
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
extract if case outside of a loop | |
diff --git a/redbaron/redbaron.py b/redbaron/redbaron.py | |
index 4d37dcb..5a7d3fd 100644 | |
--- a/redbaron/redbaron.py | |
+++ b/redbaron/redbaron.py | |
@@ -788,32 +788,22 @@ class Node(GenericNodesUtils): | |
Take a list/tuple of attributes that can match and a query, return True | |
if any of the attributes match the query. | |
""" |
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
gprof2dot -f pstats $profile_file | dot -Tpng -o $profile_graph | |
gnome-open $profile_graph |