Skip to content

Instantly share code, notes, and snippets.

@0xKD
0xKD / strip_utf.sh
Created September 3, 2017 16:14
Strip invalid chars
iconv -f utf-8 -t utf-8 -c input_file.txt > output_file.txt
@0xKD
0xKD / .vimrc
Created April 9, 2017 13:26
Vim config file
set nocompatible " be iMproved, required
filetype off " required!
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle
" required!
Plugin 'gmarik/Vundle.vim'
" git helper
@0xKD
0xKD / .env
Created February 25, 2017 15:57
Django .env sample (for django-environ)
DEBUG=True
SECRET_KEY=SSd2ZSBjb21lIHRvIHRlbGwgeW91IHdobyBraWxsZWQgb3VyIGtpbmcu
ALLOWED_HOSTS=localhost
DATABASE_URL=postgresql://127.0.0.1:5432/db
CACHE_URL=rediscache://localhost:6379/1
STATIC_ROOT=/usr/local/var/www/project/static
MEDIA_ROOT=/usr/local/var/www/project/media
@0xKD
0xKD / .editorconfig
Last active February 25, 2017 16:35
Django settings.py template (using django-environ)
root = true
; Always use Unix style new lines with new line ending on every file and trim whitespace
[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
; Python: PEP8 defines 4 spaces for indentation
[*.py]
@0xKD
0xKD / iptables-forwarding.sh
Last active March 6, 2017 03:54
Forward connections on given port to another IP and port
# Enable IP forwarding
sudo sysctl net.ipv4.ip_forward=1
# Also update the following line in /etc/sysctl.conf
# net.ipv4.ip_forward = 1
# Add iptables rules
sudo iptables -t nat -A PREROUTING -p tcp --dport 1010 -j DNAT --to-destination 10.10.10.10:1010
sudo iptables -t nat -A POSTROUTING -j MASQUERADE
@0xKD
0xKD / logstash-recursive-gzip.conf
Last active February 15, 2017 10:25
Logstash gzipped files recursively - elasticbeanstalk logs
input {
pipe {
command => "find ./path -type f -name *.gz -exec gunzip --to-stdout '{}' + "
}
}
filter {
grok {
patterns_dir => ["./patterns"]
match => [
<?xml version="1.0" ?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@0xKD
0xKD / system-fonts.css
Last active March 11, 2017 02:37
CSS - System Fonts
body {
font-family: -apple-system,
BlinkMacSystemFont,
"Segoe UI",
Roboto,
Oxygen-Sans,
Ubuntu,
Cantarell,
"Helvetica Neue";
}
def get_readonly_fields(self, request, obj=None):
"""Add this to an admin class where you need all fields to be read-only
"""
return list(set(
[field.name for field in self.opts.local_fields] +
[field.name for field in self.opts.local_many_to_many] +
[field for field in self.readonly_fields]
))
https://www.destroyallsoftware.com/talks/wat
https://www.destroyallsoftware.com/talks/
https://www.destroyallsoftware.com/talks/wat
https://www.destroyallsoftware.com/talks/the-birth-and-death-of-javascript
http://stackoverflow.com/questions/9448215/tools-to-support-live-coding-as-in-bret-victors-inventing-on-principle-talk
http://witheve.com/
https://www.infoq.com/presentations/Simple-Made-Easy
http://jugad2.blogspot.in/2016/03/tech-video-rich-hickey-hammock-driven.html
https://changelog.com/rich-hickeys-greatest-hits/
http://isotropic.org/papers/chicken.pdf