Skip to content

Instantly share code, notes, and snippets.

View zodman's full-sized avatar
🤗
Code wins arguments!

Andres Vargas zodman

🤗
Code wins arguments!
View GitHub Profile
@antonbabenko
antonbabenko / curl_all.sh
Created January 12, 2012 14:44
Curl list of urls and save http response code & times (useful for cache warmup)
#!/bin/bash
while read LINE; do
curl -o /dev/null --silent --progress-bar --head --write-out '%{http_code} %{time_starttransfer} %{url_effective}\n' "$LINE" >> urls_result.txt
done < urls.txt
@CristinaSolana
CristinaSolana / gist:1885435
Created February 22, 2012 14:56
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@afair
afair / tmux.cheat
Last active October 11, 2023 13:48
Tmux Quick Reference & Cheat sheet - 2 column format for less scrolling!
========================================== ==========================================
TMUX COMMAND WINDOW (TAB)
========================================== ==========================================
List tmux ls List ^b w
New new -s <session> Create ^b c
Attach att -t <session> Rename ^b , <name>
Rename rename-session -t <old> <new> Last ^b l (lower-L)
Kill kill-session -t <session> Close ^b &
@sdoro
sdoro / gist:4291961
Created December 15, 2012 07:39
restart OpenVPN server in CLI pfsense
echo "<?php include('openvpn.inc'); openvpn_resync_all();?>" | php -q
@reidransom
reidransom / gist:6167543
Last active December 8, 2022 05:50
HandBrakeCLI encoding for HTML5 Video

HandBrakeCLI --input 88Min_20_v2.mov --output 88Min_20_v2-handbrake.mp4 --large-file --optimize --encoder x264 --x264-preset medium --x264-profile high --x264-tune zerolatency --encopts level=3.1:vbv-bufsize=17500:vbv-maxrate=17500 --quality 22 --width 960 --height 540 --pixel-aspect 1:1 --decomb

@renyi
renyi / gist:7019854
Created October 17, 2013 06:16
Django, download and store image in ImageField
image_url = og.get('image')
if image_url:
import urllib2
from django.core.files import File
from django.core.files.temp import NamedTemporaryFile
img_temp = NamedTemporaryFile(delete=False)
img_temp.write(urllib2.urlopen(image_url).read())
img_temp.flush()
import os
@Arkham
Arkham / remote.md
Last active November 25, 2023 09:34
Remote, office not required

Remote, Office Not Required

The Time is Right for Remote Work

Why work doesn't happen at work

The office during the day has become the last place people want to be when then really want to get work done.

Offices have become interruption factories: it's just one interruption after

@dcwatson
dcwatson / range_streaming.py
Last active May 6, 2023 20:10
Django streaming view accepting byte range requests
from django.http import StreamingHttpResponse
from wsgiref.util import FileWrapper
import mimetypes
import os
import re
range_re = re.compile(r'bytes\s*=\s*(\d+)\s*-\s*(\d*)', re.I)
class RangeFileWrapper (object):
def __init__(self, filelike, blksize=8192, offset=0, length=None):
@codeinthehole
codeinthehole / uwsgi_stats
Last active May 15, 2019 22:00
Zabbix plugin script for extracting uWSGI metrics from a log file
#!/usr/bin/env python
"""
Extract metrics from a uWSGI log file
This should be saved as /etc/zabbix/pluginx/uwsgi_stats and called from
/etc/zabbix/zabbix_agentd.conf.d/uwsgi.conf, which should have contents:
UserParameter=uwsgi.stats[*],/etc/zabbix/plugins/uwsgi_stats $1 $2
To gather these metrics in Zabbix, create a new item which calls this plugin and