Skip to content

Instantly share code, notes, and snippets.

View panchicore's full-sized avatar
👽

Luis Pallares panchicore

👽
View GitHub Profile
http://www.hackerparadise.org/raffle/?ks_giveaway=win-2-years-worth-of-free-coworking-around-the-world&lucky=3034
search expensive urls in a uwsgi server log.
hits between 3 and 99 seconds:
python check.py uwsgi.log 3000 99999
output:
GET /api/1/search?q=E => generated 470381 bytes in 3433 msecs (HTTP/1.0 200) 4 headers in 135 bytes (1 switches on core 0)
GET /api/1/search?q=A => generated 586983 bytes in 4412 msecs (HTTP/1.0 200) 4 headers in 135 bytes (1 switches on core 0)
GET /api/1/search?q=R => generated 457041 bytes in 3653 msecs (HTTP/1.0 200) 4 headers in 135 bytes (1 switches on core 0)
@panchicore
panchicore / countries.json
Last active August 29, 2015 14:23
complete world countries json file (extracted from official geonames database)
[
{
"pk": 1,
"model": "countries.country",
"fields": {
"languages": "ca",
"code3": "AND",
"name": "Andorra",
"capital": "Andorra la Vella",
"country_id": 3041565,
import os
from shutil import copy2, copyfile
origin = "/Users/panchicore/Dropbox (Personal)/PSDs AQHJ 2.0/Android/assets/assets/res"
destination = "/Users/panchicore/AndroidStudioProjects/Aquehorajuega/app/src/main/res"
folders = ["drawable-hdpi", "drawable-mdpi", "drawable-xhdpi", "drawable-xxhdpi"]
filename = raw_input("filename in this dir: ")
for folder in folders:
_from = os.path.join(origin, folder, filename)
_to = os.path.join(destination, folder, filename)
@panchicore
panchicore / views.py
Last active January 19, 2024 04:27
how to use django password change form PasswordChangeForm
@login_required
def change_password(request):
if request.method == 'POST':
form = PasswordChangeForm(request.user, data=request.POST)
if form.is_valid():
form.save()
update_session_auth_hash(request, form.user) # dont logout the user.
messages.success(request, "Password changed.")
return redirect("/")
else:
66.249.73.192 - - [30/Oct/2015:18:48:12 -0500] "GET /media/thumbs/uploads/equipos/river-plate.png.50x50_q10.png HTTP/1.1" 404 144 "-" "Googlebot-Image/1.0"
@panchicore
panchicore / Android Introduction
Last active February 22, 2016 15:46
Android for [smart] dummies (complete project here: https://gitlab.com/panchicore/android-introduction)
10. blank activity
20. hello world
change hello world
saludations
30. menu
create menu layout
override onCreateOptionsMenu y onOptionsItemSelected
40. open activity con Intent
50. application class
60. models
import base64
import requests
url = "http://foo.bar"
users = ["", "admin", "root"]
for u in users:
for uu in users:
login = '{0}:{1}'.format(u, uu)
h = {"Authorization": "Basic {0}".format( base64.b64encode(login) )}
@panchicore
panchicore / pull.sh
Created March 24, 2016 12:06
pull when server starts. I use it when I run multiples intances, this is located in the supervisord config file of the AMI
#!/bin/bash
sleep 20 && cd /home/ubuntu/www/aquehorajuega.co/aquehorajuega && /usr/bin/git pull origin master && sudo supervisorctl restart aqhj
@panchicore
panchicore / timezones.html
Created April 4, 2016 19:34
AQHJ timezones
<option value="Pacific/Midway">(GMT-11:00) Midway Island, Samoa</option>
<option value="America/Adak">(GMT-10:00) Hawaii-Aleutian</option>
<option value="Etc/GMT+10">(GMT-10:00) Hawaii</option>
<option value="Pacific/Marquesas">(GMT-09:30) Marquesas Islands</option>
<option value="Pacific/Gambier">(GMT-09:00) Gambier Islands</option>
<option value="America/Anchorage">(GMT-09:00) Alaska</option>
<option value="America/Ensenada">(GMT-08:00) Tijuana, Baja California</option>
<option value="Etc/GMT+8">(GMT-08:00) Pitcairn Islands</option>