Skip to content

Instantly share code, notes, and snippets.

View PiotrCzapla's full-sized avatar

Piotr Czapla PiotrCzapla

View GitHub Profile
@PiotrCzapla
PiotrCzapla / DebugUtils.h
Created April 5, 2012 11:49
Dump view hierarchy to NSLog
#import <Foundation/Foundation.h>
@interface DebugUtils : NSObject
/**
* Dump view hierarchy to NSLog
*/
+ (void) dumpViews:(UIView*)view;
@end
@PiotrCzapla
PiotrCzapla / sha1compare.sh
Created October 7, 2013 14:51
A cygwin script to compare a content of workarea with content of STAGING
function tsurl() {
dir=$(realpath "$*");
echo "${dir/cygdrive\/y//localhost}"
}
function dump_ea_txt {
src=${1:-.}
filter=${3:-TeamSite/Metadata/.*}
dest=${2:-/cygdrive/c/tmp}
echo "Extracting extattrs maching $filter from $src to $dest"
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<deploymentConfiguration>
<logRules maxBytes="32Mb" level="verbose"/>
<localNode host="localhost"/>
<definition name="PushToGit">
<source>
<fileSystem>
<remoteDiff area="/tmp/od"> <!-- just a dummy deploy -->
<pathSpecification>
@PiotrCzapla
PiotrCzapla / cache.ccf
Created May 6, 2015 11:26
How to disable livesite cache
jcs.default=
jcs.default.cacheattributes.MaxObjects=0
@PiotrCzapla
PiotrCzapla / Add Last Email Sent to OmniFocus.applescript
Last active December 29, 2015 18:17 — forked from simplicitybliss/Add Last Email Sent to OmniFocus.applescript
Short AppleScript that adds the last email sent in Mail.app to the OmniFocus Inbox as a task
(*
Add last sent email to OmniFocus Script
by simplicitybliss.com, Sven Fechner
Straight forward script that sends the last email sent in Mail.app to OmniFocus either using the Quick Entry window or silently (well, with Growl based notifications if desired) straight to the Inbox.
You can influence how the task is named by modifying the PreFix and MidFix properties. The note of the task will contain a link back the email in Mail.app.
Use the AppleScript Menu or tools likle FastScripts, Launchbar or Alfred to trigger the script.
@PiotrCzapla
PiotrCzapla / install-macvim-with-lua.sh
Last active April 25, 2021 00:23 — forked from lodestone/install-macvim-with-lua.sh
brew install macvim with lua
# http://www.gonzedge.com/blog/2016/01/11/installing-macvim-with-lua-enabled-through-homebrew.html
brew install macvim --with-cscope --with-lua --override-system-vim --with-luajit --with-python3
# in case linking fails
rm $(which mvim)
brew link macvim
brew linkapps macvim
# making an alias after symlinking
@PiotrCzapla
PiotrCzapla / Import Discord Messages to Slack.md
Last active February 22, 2018 13:37
Import Discord Messages to Slack

How To

First you have to download your messages in json format, this bookmarklet works like a charm: https://dht.chylex.com/ You will end up with file like this:

{
  "meta": {
    "users": {}
    .....
  },

"data": {

@PiotrCzapla
PiotrCzapla / transforms v2 proposal.md
Last active April 8, 2018 09:19
fastai trasnforms.py v2

Here is an example how Transformations could look like in future:

class CoordTransform(Transform):
    def determ(self):
        return CoordAction(self, self.new_state())
    def new_state(self): return {}

class RandomRotate(CoordTransform):
    def __init__(self, deg, p=0.75, mode=cv2.BORDER_REFLECT):
@PiotrCzapla
PiotrCzapla / test_json_each.py
Last active August 31, 2021 11:43
How to use JSON_EACH / JSONB_EACH in sqlalchemy
import pytest
from sqlalchemy.exc import SAWarning
from sqlalchemy import Column, func, create_engine, Integer, JSON
from sqlalchemy.orm import declarative_base, Session
Base = declarative_base()
class EventHistory(Base):
__tablename__ = 'event_history'
id = Column(Integer, nullable=False, primary_key=True)
@PiotrCzapla
PiotrCzapla / wpcli.bash_alias.sh
Created September 22, 2021 07:48
How to add a wp cli isolated ina a docker container
function wpcli(){
docker run -v $(pwd):/var/www/html --rm -it -u "$(stat -c'%u' .)" wordpress:cli "$@"
}
alias wp='wpcli wp'