Skip to content

Instantly share code, notes, and snippets.

Bookmarklet to Post to Slack


Please note that this has a little problem: It posts the links as Slack Bot and not as yourself. You could add your name to the message but doesn't look right.


I've created a little bookmarklet that posts the url of the current webpage to a Slack channel. You have to set your token and the channel name manually but it's all fun and profit from there.

@carlosefonseca
carlosefonseca / mergecode.py
Created March 11, 2014 17:29
Adds code files into markdown
#!/usr/bin/env python3
# coding=utf-8
import sys
import re
import os
import shutil
if len(sys.argv) < 2:
@carlosefonseca
carlosefonseca / json2gfmtable.py
Last active June 24, 2016 04:41
Creates a GitHub Flavored Markdown table from a JSON array passed to the stdin. Accepts a list of column names as the argument for column ordering and filtering.
#!/usr/bin/env python3
# coding=utf-8
import json
import sys
# only reads from stdin
j = json.loads(sys.stdin.read())
# reads a list of column names from the argument "col1,col2" etc
@carlosefonseca
carlosefonseca / Add lines as Reminders
Last active January 3, 2016 21:59
Add selected lines of text as new reminders. Asks for what list. Use as Automator service script. Requires http://applescript.bratis-lover.net/library/string/ to be a Script Library.
on run {input, parameters}
set input to (first item of input)
tell script "_string" to set input to trimBoth(input)
set lst to every paragraph of input
tell application "Reminders"
activate
set aList to (name of lists)
set theList to some list whose name is (first item of (choose from list aList))
@carlosefonseca
carlosefonseca / sqlite2csv.sh
Created January 9, 2014 13:44
Exports all tables in a sqlite database to CSV.
#!/usr/bin/env bash
# obtains all data tables from database
TS=`sqlite3 $1 "SELECT tbl_name FROM sqlite_master WHERE type='table' and tbl_name not like 'sqlite_%';"`
# exports each table to csv
for T in $TS; do
sqlite3 $1 <<!
.headers on
@carlosefonseca
carlosefonseca / ipaversion.sh
Last active December 27, 2015 12:39
Output the version and build of an iOS .ipa file.
#!/usr/bin/env bash
plist="/tmp/BAMInfo.plist"
zippath=`unzip -l $1 | egrep -o "Payload/.*app/Info.plist"`
unzip -p $1 $zippath > $plist
version=`/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" $plist`
package pt.beware.remotelogging;
import android.content.Context;
import com.carlosefonseca.common.utils.CodeUtils;
import com.carlosefonseca.common.utils.Log;
import java.lang.reflect.Array;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@carlosefonseca
carlosefonseca / json2csv.py
Created September 17, 2013 23:05
Basic conversion of a JSON [{"a":"b",…},{"a":"c",…}] to csv.
#!/usr/bin/env python
# coding=utf-8
import json
import sys
import codecs
import csv,codecs,cStringIO
class UTF8Recoder:
def __init__(self, f, encoding):
@carlosefonseca
carlosefonseca / wkt2kml.py
Created September 17, 2013 22:58
Converts WKT to KML.
#!/usr/bin/env python
# coding=utf-8
import sys
import re
import simplekml
import argparse
import random
def splitByLines(wkt):
@carlosefonseca
carlosefonseca / GPXWriter.java
Created August 2, 2013 20:26
Writes a list of timed coordinates to a GPX file.
package pt.beware.core;
import android.location.Location;
import pt.beware.common.utils.Log;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;