Skip to content

Instantly share code, notes, and snippets.

View hiphamster's full-sized avatar

Alex Yelluas hiphamster

View GitHub Profile
@hiphamster
hiphamster / _readme.md
Last active August 29, 2015 14:17 — forked from shime/_readme.md

Having trouble installing the latest stable version of tmux?

I know, official package for your OS/distro is outdated and you just want the newest version of tmux.

Well, this script should save you some time with that.

Prerequisities

  • gcc

Keybase proof

I hereby claim:

  • I am hiphamster on github.
  • I am hiphamster (https://keybase.io/hiphamster) on keybase.
  • I have a public key whose fingerprint is AFC2 84E8 92A8 F0D7 21AA E885 5006 BFD6 4676 8E0F

To claim this, I am signing this object:

@hiphamster
hiphamster / imgcmp.py
Created June 30, 2017 18:33 — forked from attilaolah/imgcmp.py
Fast image comparison with Python
import math
import Image
import Levenshtein
class BWImageCompare(object):
"""Compares two images (b/w)."""
_pixel = 255
@hiphamster
hiphamster / pandoc.css
Created August 3, 2017 03:24 — forked from killercup/pandoc.css
Add this to your Pandoc HTML documents using `--css pandoc.css` to make them look more awesome. (Tested with Markdown and LaTeX.)
/*
* I add this to html files generated with pandoc.
*/
html {
font-size: 100%;
overflow-y: scroll;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}
@hiphamster
hiphamster / 0_reuse_code.js
Created August 5, 2017 18:13
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@hiphamster
hiphamster / cue_to_mp3.py
Created January 14, 2018 20:05 — forked from bancek/cue_to_mp3.py
CUE splitter using ffmpeg (to mp3)
cue_file = 'file.cue'
d = open(cue_file).read().splitlines()
general = {}
tracks = []
current_file = None
@hiphamster
hiphamster / pytest.md
Created March 1, 2018 09:00 — forked from kwmiebach/pytest.md
pytest cheat sheet

Usage

(Remember to create a symlink pytest for py.test)

pytest [options] [file_or_dir] [file_or_dir] ...

Help:

@hiphamster
hiphamster / find_anagrams.cl
Created March 1, 2018 23:03
sample clojure code
(ns anagram
(:gen-class))
(defn anagrams-for
"select anagrams from the list of words"
([] "nothing")
([word words]
(let [ word-chars (frequencies (for [c (clojure.string/lower-case word)] c))
@hiphamster
hiphamster / browser_history.md
Created August 30, 2018 21:30 — forked from dropmeaword/browser_history.md
Playing around with Chrome's history

Browser histories

Unless you are using Safari on OSX, most browsers will have some kind of free plugin that you can use to export the browser's history. So that's probably the easiest way. The harder way, which seems to be what Safari wants is a bit more hacky but it will also work for other browsers. Turns out that most of them, including Safari, have their history saved in some kind of sqlite database file somewhere in your home directory.

The OSX Finder cheats a little bit and doesn't show us all the files that actually exist on our drive. It tries to protect us from ourselves by hiding some system and application-specific files. You can work around this by either using the terminal (my preferred method) or by using the Cmd+Shft+G in Finder.

Finder

Once you locate the file containing the browser's history, copy it to make a backup just in case we screw up.

@hiphamster
hiphamster / gist:be10896f1d693b7e5cfd94f864d85ef8
Created August 31, 2018 06:55 — forked from emptyhammond/gist:1603144
Make a PUT request with jQuery.ajax()
$.ajax({
type: 'POST', // Use POST with X-HTTP-Method-Override or a straight PUT if appropriate.
dataType: 'json', // Set datatype - affects Accept header
url: "http://example.com/people/1", // A valid URL
headers: {"X-HTTP-Method-Override": "PUT"}, // X-HTTP-Method-Override set to PUT.
data: '{"name": "Dave"}' // Some data e.g. Valid JSON as a string
});
/* Some clients do not support PUT or it’s difficult to send in a PUT request. For these cases, you could POST the request with a request header of X-HTTP-Method-Override set to PUT. What this tells the server is that the intended request is a PUT. Obviously this relies on the API you are accessing making use of the X-HTTP-Method-Override Header.*/