Skip to content

Instantly share code, notes, and snippets.

@ctrngk
ctrngk / osx_automount_nfs.md
Created June 19, 2018 16:17 — forked from L422Y/osx_automount_nfs.md
Automounting NFS share in OS X into /Volumes

I have spent quite a bit of time figuring out automounts of NFS shares in OS X...

Somewhere along the line, Apple decided allowing mounts directly into /Volumes should not be possible:

/etc/auto_master (see last line):

#
# Automounter master map
#

+auto_master # Use directory service

@ctrngk
ctrngk / remove_tuxera.sh
Created June 19, 2018 12:06 — forked from miguelmota/remove_tuxera.sh
Completely uninstall and remove Tuxera NTFS on MacOs (resets trial version)
rm -rf /Applications/Tuxera\ Disk\ Manager.app
rm -rf /Library/Application\ Support/Tuxera\ NTFS
rm -rf /Library/Filesystems/fusefs_txantfs.fs
@ctrngk
ctrngk / info.md
Created June 12, 2018 16:54 — forked from marteinn/info.md
Using the Fetch Api with Django Rest Framework

Using the Fetch Api with Django Rest Framework

Server

First, make sure you use the SessionAuthentication in Django. Put this in your settings.py

# Django rest framework
REST_FRAMEWORK = {
    'DEFAULT_AUTHENTICATION_CLASSES': [
 'rest_framework.authentication.SessionAuthentication'
@ctrngk
ctrngk / gist:92138847f7e2558eca022ae5eb39b589
Last active June 8, 2018 11:55
fold python hunter log files in vim
function! Hunter()
" It takes 2 mins to fold 400k lines in my macbook air.
function! ColBase()
" determine column number (3rd col, code part) in the first (base) line
call cursor(1, 1)
let mypattern = '\v(.+:\d+\s+\w+\s+!\s+\zs)|(.+:\d+\s+\w+\s+\zs)'
let [lnum, colbase] = searchpos(mypattern, 'n')
return colbase
endfunction
@ctrngk
ctrngk / 0readme.md
Created May 23, 2018 02:46 — forked from mdamien/0readme.md
404 link detector with scrapy

List all the broken links on your website

Requirements:

python3 and scrapy (pip install scrapy)

Usage

  • scrapy runspider -o items.csv -a site="https://yoursite.org" 1spider.py
  • python3 2format_results.py
@ctrngk
ctrngk / TorPrivoxyPython.md
Created May 19, 2018 09:29 — forked from DusanMadar/TorPrivoxyPython.md
A step-by-step guide how to use Python with Tor and Privoxy
@ctrngk
ctrngk / withsqlite.py
Created April 30, 2018 05:11 — forked from miku/withsqlite.py
Simple sqlite3 context manager for Python.
#!/usr/bin/env python
import sqlite3
class dbopen(object):
"""
Simple CM for sqlite3 databases. Commits everything at exit.
"""
def __init__(self, path):
self.path = path
@ctrngk
ctrngk / web-servers.md
Created April 4, 2017 06:18 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@ctrngk
ctrngk / uninstall.sh
Created March 31, 2017 08:55 — forked from myusuf3/uninstall.sh
how to cleanly uninstall python packages installed with python setup.py
# Next time you need to install something with python setup.py -- which should be never but things happen.
python setup.py install --record files.txt
# This will cause all the installed files to be printed to that directory.
# Then when you want to uninstall it simply run; be careful with the 'sudo'
cat files.txt | xargs sudo rm -rf
@ctrngk
ctrngk / gist:b562ac8bea6b90c0aafb06b266b8805a
Created March 12, 2017 00:06 — forked from issackelly/gist:928783
Django Template {{ block.super }} example
# Template: A.html
<html>
<head></head>
<body>
{% block hello %}
HELLO
{% endblock %}
</body>
</html>