![]() |
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 | |
declare -a pids | |
for i in {1..10} | |
do | |
toptask=$(ps -eo pcpu=,pid= | sed 's/^ *//' | tr -s ' ' '\t' | sort -grk1 | head -1) | |
cpu=$(echo $toptask | tr -s ' ' '\t' | cut -f1 | cut -d. -f1) | |
pid=$(echo $toptask | tr -s ' ' '\t' | cut -f2) | |
if (( cpu > 100 )); then |
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
--- RJDBC0.2-6/R/class.R 2017-02-07 21:38:59.000000000 +0100 | |
+++ RJDBC0.2-6mod/R/class.R 2017-03-22 02:39:42.000000000 +0100 | |
@@ -37,18 +37,12 @@ | |
setMethod("dbUnloadDriver", "JDBCDriver", def=function(drv, ...) FALSE) | |
setMethod("dbConnect", "JDBCDriver", def=function(drv, url, user='', password='', ...) { | |
- jc <- .jcall("java/sql/DriverManager","Ljava/sql/Connection;","getConnection", as.character(url)[1], as.character(user)[1], as.character(password)[1], check=FALSE) | |
- if (is.jnull(jc) && !is.jnull(drv@jdrv)) { | |
- # ok one reason for this to fail is its interaction with rJava's | |
- # class loader. In that case we try to load the driver directly. |
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 python3 | |
from sys import argv | |
from mediafile import MediaFile | |
def main(): | |
args = argv[1:] | |
first_file = True |
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 'json' | |
Dir.glob(ARGV).each do |fname| | |
note = {} | |
note['createdate']=File.ctime(fname).to_f | |
note['modifydate']=File.mtime(fname).to_f | |
f=File.read(fname) | |
note['content']=f.gsub(/(#|@)([0-9a-zA-Z_\-]+)/,'\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
require 'pdf-reader' | |
require './markup_receiver' | |
doc = PDF::Reader.new(ARGV[0]) | |
$objects = doc.objects | |
def is_note?(object) | |
object[:Type] == :Annot && [:Text, :FreeText].include?(object[:Subtype]) | |
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
#!/bin/sh | |
# This is an example ran on Cote des Neiges data | |
# Fix text encoding | |
iconv -f WINDOWS-1252 -t UTF-8 Cote_des_Neiges_Notre_Dame_de_Grace_Arbres_publics_2015_12_02.csv > cdn.csv | |
# Remove spaces | |
sed -i -r 's/ +/ /g' cdn.csv | |
# Convert to tab-delimited | |
q -d ";" -T "select * from cdn.csv" > cdnfinal.csv |
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
userCustom.onPagedownConfigure = function(editor) { | |
var converter = editor.getConverter(); | |
function csvToMarkdown( csvContent, delimiter, hasHeader ) { | |
if( delimiter != "\t" ) { | |
csvContent = csvContent.replace(/\t/g, " "); | |
} | |
var columns = csvContent.split("\n"); | |
var tabularData = []; |
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/osascript | |
-- Copyright © 2016, Mahmood Shafeie Zargar all rights reserved | |
-- This program is released under the terms of MIT License | |
-- Sort routine from http://www.macosxautomation.com/applescript/sbrt/sbrt-05.html | |
on run argv | |
try | |
set argument to item 1 of argv | |
on error |
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 objc | |
import AddressBook as ab | |
import pprint as pp | |
def pythonize(objc_obj): | |
if isinstance(objc_obj, objc.pyobjc_unicode): | |
return unicode(objc_obj) | |
elif isinstance(objc_obj, ab.NSDate): | |
return objc_obj.description() |