Skip to content

Instantly share code, notes, and snippets.

View nuty's full-sized avatar

Rosso nuty

  • beijing
View GitHub Profile
@nuty
nuty / gist:9502630
Created March 12, 2014 07:55
jsonify for django
#-*- coding:utf8 -*-
from django.utils import simplejson as json
from django.http import HttpResponse
def jsonify(*args, **kwargs):
if len(args) == 1:
content = json.dumps(args[0])
else:
content = json.dumps(dict(*args, **kwargs))
response = HttpResponse(content=content, mimetype="application/json")
@nuty
nuty / view.py
Created August 13, 2014 09:19
create edit view
@login_required(login_url='/admin/')
def ad_edit(request,id=None):
cities = City.objects.filter(status='1')
adzones = AdZone.objects.all()
channel_choices = Ad.get_channel_choices()
ad = get_object_or_none(Ad,pk=id)
is_edit = True if ad is not None else False
form = AdForm(instance=ad)
action = Log.ADDITION if ad is None else Log.CHANGE
if request.method == 'POST':
#lang racket
(require net/url)
(require db)
(require (planet neil/html-parsing:3:0))
(require (planet clements/sxml2:1))
(define base-url "http://www.lagou.com/gongsi/interviewExperiences.html?companyId=")
(define range-start 3000)
(define range-end 5000)
(define name-partern "//a/@title/text()") ;name 名称
sudo yum install -y autoconf automake cmake freetype-devel gcc gcc-c++ git libtool make mercurial nasm pkgconfig zlib-devel
mkdir ~/ffmpeg_sources
cd ~/ffmpeg_sources
git clone --depth 1 git://github.com/yasm/yasm.git
cd yasm
autoreconf -fiv
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin"
make
[
{
"hostname": "0-----findandbuydrugs.grams7enekj3fhxz.onion",
"uri": "http://0-----findandbuydrugs.grams7enekj3fhxz.onion/"
},
{
"hostname": "0-0helix.grams7enekj3fhxz.onion",
"uri": "http://0-0helix.grams7enekj3fhxz.onion/"
},
{
[{"update_time": "2017-02-17 19:27:56", "type": "program_ondemand", "duration": 1094, "id": 6536143, "desc": "", "name": "\u7b2c309\u671f\uff1a\u8f7b\u8f7b\u5730\u6211\u8d70\u4e86\uff0c\u6b63\u5982\u6211\u8f7b\u8f7b\u5730\u6765", "img_url": "", "channel_id": "143114", "playcount": "1.0\u4e07", "res_id": 6809669, "file_path": "m4a/58a6dda17cb8913976a560a0_6809669_64.m4a"}, {"update_time": "2017-02-13 18:04:05", "type": "program_ondemand", "duration": 1472, "id": 6505961, "desc": "", "name": "\u7b2c308\u671f\uff1a\u662f\u771f\u7684\uff0c\u4e2d\u4fc4\u5408\u4f5c\u91cd\u578b\u76f4\u5347\u673a", "img_url": "", "channel_id": "143114", "playcount": "18.9\u4e07", "res_id": 6788314, "file_path": "m4a/58a183a97cb8913976a534d0_6788314_64.m4a"}, {"update_time": "2017-02-11 20:19:38", "type": "program_ondemand", "duration": 3731, "id": 6496588, "desc": "", "name": "\u519b\u8ff7\u517b\u6210\u4e4b\u6a21\u578b\u7bc7", "img_url": "", "channel_id": "143114", "playcount": "19.5\u4e07", "res_id": 6780354, "file_path": "m4a/589ef
import os
import sys
walk_dir = sys.argv[1]
print('walk_dir = ' + walk_dir)
# If your current working directory may change during script execution, it's recommended to
# immediately convert program arguments to an absolute path. Then the variable root below will
# be an absolute path as well. Example:
@nuty
nuty / geojson-beijing.json
Last active May 6, 2019 09:15
yanqing-json
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import os
os.walk('.')