Skip to content

Instantly share code, notes, and snippets.

@jhaddix
jhaddix / content_discovery_all.txt
Created May 26, 2018 11:51
a masterlist of content discovery URLs and files (used most commonly with gobuster)
This file has been truncated, but you can view the full file.
`
~/
~
ים
___
__
_
@bitwalker
bitwalker / config.ex
Created July 19, 2016 23:00
Useful config wrapper for Elixir
defmodule Config do
@moduledoc """
This module handles fetching values from the config with some additional niceties
"""
@doc """
Fetches a value from the config, or from the environment if {:system, "VAR"}
is provided.
An optional default value can be provided if desired.
@kzkin
kzkin / phoenix-app.service
Last active October 30, 2018 19:16
systemd service for phoenix framework release (exrm)
# Phoenix Framework - A productive web framework that does not compromise speed and maintainability
[Unit]
Description=Phoenix Framework ISControl Application
After=network.target
[Service]
Type=simple
User=deployer
RemainAfterExit=yes
@jeremyjbowers
jeremyjbowers / actions.py
Created November 24, 2015 21:47
Export to CSV for Django admin
import csv
from django.http import HttpResponse
def export_as_csv_action(description="Export selected objects as CSV file", fields=None, exclude=None, header=True):
"""
This function returns an export csv action
'fields' and 'exclude' work like in django ModelForm
'header' is whether or not to output the column names as the first row
"""
def export_as_csv(modeladmin, request, queryset):
@camshaft
camshaft / start.sh
Last active April 9, 2017 16:01
elixir startup script with graceful shutdown
#!/bin/bash
HOSTNAME="localhost"
PORT=${PORT-4000}
NODE="app_$PORT"
if [ -z "$COOKIE" ]
then
COOKIE=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
fi
@bee-keeper
bee-keeper / Disable allauth registration
Created May 19, 2014 13:30
Disable allauth signup/registration
"""
Disable registration/signup
"""
#models.py
from allauth.account.adapter import DefaultAccountAdapter
class MyAccountAdapter(DefaultAccountAdapter):
def is_open_for_signup(self, request):
return False
# If you're looking into the C10M problem (10 million concurrent connections)
# you might want to play with DPDK (Originally proprietry Intel, now open source)
#
# C10M: http://c10m.robertgraham.com/
# DPDK: http://dpdk.org/
#
# This is a quick summary how to install dpdk on ubuntu
# running inside virtualbox on a mac
# On my Mac:
@aras-p
aras-p / preprocessor_fun.h
Last active May 8, 2024 06:45
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
@mgerring
mgerring / actions.py
Created September 5, 2012 22:04
"Export to CSV" action for django admin
import unicodecsv
from django.http import HttpResponse
def export_as_csv_action(description="Export selected objects as CSV file",
fields=None, exclude=None, header=True):
"""
This function returns an export csv action
'fields' and 'exclude' work like in django ModelForm
'header' is whether or not to output the column names as the first row
"""
@wolever
wolever / geventfd.py
Created June 12, 2012 07:25
Simple wrapper around a file descriptor which will perform non-blocking reads/writes using gevent
import os
import fcntl
from gevent.core import wait_read, wait_write
class GeventFD(object):
""" Wrap a file descriptor so it can be used for non-blocking reads and writes with gevent.
>>> stdin = GeventFD(sys.stdin.fileno())
>>> stdin.read(5)
'hello'