Skip to content

Instantly share code, notes, and snippets.

View daleathan's full-sized avatar
🏠
Working from home

Dale Athanasias daleathan

🏠
Working from home
View GitHub Profile
@daleathan
daleathan / search-git-history.md
Created February 25, 2018 06:29 — forked from lyoshenka/search-git-history.md
Search Git commit history for a string and see the diffs

Searching Git commit history

This should be one of the core features of Git, but for some reason it's impossible to figure out how to search for a string in your commit history and see the diffs that that string is in. Here's the best I've come up with:

To find which commits and which files a string was added or removed in:

git log -S'search string' --oneline --name-status

To see the diff of that

@daleathan
daleathan / merge-repo-to-subdir.sh
Created July 15, 2017 22:49 — forked from andsens/merge-repo-to-subdir.sh
Merges a repo into a subdirectory of another repo (useful when making a submodule part of a parent repo)
#!/bin/bash -e
function merge_repo_to_subdir {
local url=$1
local commit=$2
local module_path=$3
if [[ -z $url || -z $commit || -z $module_path ]]; then
echo "Usage: merge-repo-to-subdir.sh URL BRANCH PATH" >&2
exit 1
@daleathan
daleathan / Git push deployment in 7 easy steps.md
Created December 1, 2016 01:58 — forked from thomasfr/Git push deployment in 7 easy steps.md
7 easy steps to automated git push deployments. With small and configurable bash only post-receive hook
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
def fuzzy_match_simple(pattern, instring):
"""Return True if each character in pattern is found in order in instring.
:param pattern: the pattern to be matched
:type pattern: ``str``
@daleathan
daleathan / wclip.py
Created March 27, 2016 20:24 — forked from Asday/wclip.py
from collections import OrderedDict
from ctypes import sizeof
from ctypes.wintypes import (
DWORD,
LONG,
WORD,
)
import pygame
from win32clipboard import (
@daleathan
daleathan / wgets.wsf
Created March 25, 2016 04:12 — forked from atifaziz/wgets.wsf
Simple WGET clone in WSH
<job>
<runtime>
<description>A non-interactive web retriever script.
Copyright (c) Atif Aziz. All rights reserved.
Written by Atif Aziz, http://www.raboof.com/
Creative Commons Attribution-ShareAlike 3.0 Unported License.
http://creativecommons.org/licenses/by-sa/3.0/
</description>
#!/usr/bin/env python3
import struct
import re
class Wad(object):
"""Encapsulates the data found inside a WAD file"""
def __init__(self, wadFile):
"""Each WAD files contains definitions for global attributes as well as map level attributes"""

I like Learn You a Haskell as a reference and cheat-sheet but I found it a little slow for learning Haskell.

Here's my recommended order for just learning Haskell:

http://www.seas.upenn.edu/~cis194/lectures.html Brent Yorgey's course is the best I've found so far and replaces both Yann Esposito's HF&H and the NICTA course. This course is particularly valuable as it will not only equip you to write Haskell but also help you understand parser combinators.

Real World Haskell is available online. (Thanks bos!)

I recommend RWH as a reference (thick book). The chapters for parsing and monads are great for getting a sense for where monads are useful. Other people have said that they've liked it a lot. Perhaps a good follow-up for practical idioms after you've got the essentials of Haskell down?

@daleathan
daleathan / tree.md
Created March 10, 2014 19:22 — forked from hrldcpr/tree.md

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

from Tkinter import *
root = Tk()
w = Label(root, text="Hello, world!")
root.overrideredirect(True)
root.geometry("{0}x{1}+0+0".format(root.winfo_screenwidth(), root.winfo_screenheight()))
root.focus_set() # <-- move focus to this widget
root.bind("<Escape>", lambda e: e.widget.quit())
w.pack()