Skip to content

Instantly share code, notes, and snippets.

@simkimsia
simkimsia / browser_history.md
Created October 24, 2020 07:55 — 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.

@KeyTransform.register_lookup
class KeyTransformIsInteger(KeyTransformTextLookupMixin, Lookup):
lookup_name = "is_int"
def as_sql(self, compiler, connection):
import ipdb
ipdb.set_trace()
lhs, lhs_params = self.process_lhs(compiler, connection)
rhs, rhs_params = self.process_rhs(compiler, connection)
@simkimsia
simkimsia / annotate.php
Created June 22, 2012 07:45
annotate english or chinese text on image
<?php
header('Content-Type: text/html; charset=utf-8');
mb_internal_encoding('utf-8');
function wordWrapAnnotation(&$image, &$draw, $text, $maxWidth)
{
// separate the text by chinese characters or words or spaces
preg_match_all('/([\w]+)|(.)/u', $text, $matches);
// $words is array of Chinese characters, English Words or spaces
@simkimsia
simkimsia / whitehead_terms.md
Last active February 14, 2020 15:58
whitehead terms

whitehead's use

prehension

prehension = grasping

actual occasion

actual occasion =

substance-quality category

substance-quality category =

@simkimsia
simkimsia / installation-12-10-ubuntu.sh
Last active February 12, 2020 10:46
preparing a fresh 12.10 ubuntu server for cakephp 2.4
#!/bin/bash
###
#
# forked from https://gist.github.com/1264701/08f93534ba177f173b9382b53c419cd0de5b07ea
# Copyright (c) 2011 Cake Development Corporation (http//cakedc.com)
#
# Ubuntu 12.10 based web server installation script
# Run this by executing the following from a fresh install of Ubuntu 12.10 server:
#
@simkimsia
simkimsia / encoders.py
Created November 3, 2019 10:51
For the long story read the tweet thread on pt 34 here https://twitter.com/KimStacks/status/1190943466492051457
"""
Helper classes for parsers.
"""
import datetime
import decimal
import json # noqa
class FromValuesToDRFJSONEncoder(json.JSONEncoder):
"""
@simkimsia
simkimsia / gist:4442745
Created January 3, 2013 11:18
convenient bash script to install guest-additions for virtualbox vm. Run script in ubuntu guest OS. Not host.
#!/bin/bash
###
#
# Copyright (c) 2013 KimSia
#
# Ubuntu 12.10 based web server VirtualBox Guest Additions installation script on Guest Ubuntu
# Run this by executing the following from a fresh install of Ubuntu 12.10 server:
#
# bash -c "$(curl -fsSL https://raw.github.com/gist/4442745)"
@simkimsia
simkimsia / conflicts.md
Last active July 11, 2018 09:42
text diagram for git conflicts
              master
                |
                |
   +-------<----+----->------+
   |            |            |
   |            |            |
   |            |            |
branch1         |         branch2
   |            |            |
@simkimsia
simkimsia / another_expected_config.js
Created May 1, 2018 05:09
Possible config for tableup
// inspired by datatables.net
// see https://datatables.net/examples/basic_init/filter_only.html for example
$(document).ready(function() {
$('#example').TableUp( {
"paging": true,
"rowsPerPageOptions": [2, 5, 10],
"rowsPerPage": 5,
"checkbox": true,
"search": true
@simkimsia
simkimsia / kafka-commands.md
Last active April 16, 2018 11:26
Kafka commands

Commands

How to get started

  1. start docker

  2. run this command in 1 terminal

docker run --rm -it \
           -p 2181:2181 -p 3030:3030 -p 8081:8081 \
           -p 8082:8082 -p 8083:8083 -p 9092:9092 \