Skip to content

Instantly share code, notes, and snippets.

elky elky

Block or report user

Report or block elky

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@elky
elky / gist:9800475
Created Mar 27, 2014
Grunt watcher on django runserver
View gist:9800475
import os
import subprocess
import atexit
import signal
from optparse import make_option
from multiprocessing import Process
from django.conf import settings
from django.contrib.staticfiles.management.commands.runserver import Command\
as StaticfilesRunserverCommand
View keybase.md

Keybase proof

I hereby claim:

  • I am elky on github.
  • I am elky (https://keybase.io/elky) on keybase.
  • I have a public key whose fingerprint is 6551 4E34 B27B DC82 49E0 EEAF 2BE8 F570 B254 22B6

To claim this, I am signing this object:

@elky
elky / run_gunicorn.sh
Created Jun 12, 2015
Simple example of gunicorn script for Django project
View run_gunicorn.sh
#!/bin/bash
set -e
LOGFILE=/srv/www/website/log/gunicorn.log
LOGDIR=$(dirname $LOGFILE)
NUM_WORKERS=3
SOCKFILE=/srv/www/website/run/gunicorn.sock
RUNDIR=$(dirname $SOCKFILE)
DJANGO_SETTINGS_MODULE=website.settings
DJANGO_WSGI_MODULE=website.wsgi
@elky
elky / danted.conf
Created Apr 17, 2018
Dante SOCKS proxy configuration for version 1.11.9
View danted.conf
logoutput: stderr
internal: eth0 port = 1085
external: eth0
method: username none
user.privileged: root
user.notprivileged: nobody
client pass {
from: 0.0.0.0/0 to: 0.0.0.0/0
@elky
elky / truncate.css
Created Sep 1, 2016
text-overflow ellipsis with 100% width
View truncate.css
/*
Demo: https://jsfiddle.net/elky/f6khaf2t/
<div class="element">
<div class="truncate">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt
ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco
laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in
voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat
non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
@elky
elky / scraper.py
Created Jun 15, 2018
instagram-scraper without having to run shell command. May need for security reasons (passing variables to shell command on server is risky)
View scraper.py
from instagram_scraper.app import InstagramScraper
def scrape_instagram_feed(form_data):
data = {
'username': form_data.get('username'),
'usernames': [form_data.get('username')],
'login_user': form_data.get('username'),
'login_pass': form_data.get('password'),
'destination': 'instagram_data',
@elky
elky / example.py
Created Dec 23, 2016
Django JSONField prevent Unicode sequence in Admin
View example.py
# utils.py
import json
from django.contrib.postgres.forms.jsonb import InvalidJSONInput, JSONField
class ReadableJSONFormField(JSONField):
def prepare_value(self, value):
if isinstance(value, InvalidJSONInput):
return value
return json.dumps(value, ensure_ascii=False, indent=4)
@elky
elky / input_file.css
Last active Jul 11, 2019
Stylized input file. With file path. No extra divs. Single line JS
View input_file.css
/*
Demo: https://jsfiddle.net/elky/ecvy78tu/
Works in webkit browsers only.
<input type="file" data-file="No file chosen" onchange="this.dataset.file=this.files[0].name" multiple>
*/
input[type="file"] {
position: relative;
text-overflow: ellipsis;
You can’t perform that action at this time.