Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am ydnax on github.
  • I am xandy (https://keybase.io/xandy) on keybase.
  • I have a public key whose fingerprint is E85D 8D0A C943 5722 6852 B43A 1F26 8399 3387 09A1

To claim this, I am signing this object:

#include "Level.hpp"
#include <iostream>
#include <cassert>
namespace picppgl{
using namespace std;
void Level::update(int ticks){
cout<<"-----level update "<<( objects.data().size() )<<endl;
objects.realDelete();
cout<<"-- post gc"<<( objects.data().size() )<<endl;
for(auto &&obj: objects.data()){
@ydnax
ydnax / example.cpp
Created April 27, 2012 15:03
small function timer in c++11
#include <iostream>
#include <chrono>
#include <thread>
#include "timer.hpp"
int main(){
std::chrono::milliseconds nap( 2000 );
std::cout<<timer([&](){std::this_thread::sleep_for( nap );}).count()<<std::endl;
}
from django.contrib.auth import login,logout,authenticate
#viel code dazwischen
def login(request, loginid):
try:
user=UserProfile.objects.filter(mailcode=loginid)[0].user
newpass=id_generator(50)
user.set_password(newpass)
newpass=id_generator(50)
user.set_password(newpass)
user.save()
au=authenticate(username=user, password=newpass)
print au
login(request, au)
print request.user
newpass=id_generator(50)
user.set_password(newpass)
user.save()
au=authenticate(username=user, password=newpass)
print au
login(request, au)
print request.user
void energy::update(ticks time){
const float angle=getAngle(start, target);
float fx, fy, tx, ty;
fx=start.x;
fy=-1*start.y;
tx=target.x;
ty=-1*target.y;
float dx,dy;
const float vert=getPointDistance(start, target);
const float addl=pxps*(time/1000);
@ydnax
ydnax / gist:1711116
Created January 31, 2012 15:37
basic template for django forms with twitter bootstrap style error messages
{% extends "base.html" %}
{% block title %}
{{ title }}
{% endblock %}
{% block content %}
<form action="{{ action }}" method="{% block method %}post{% endblock %}">
{% for field in form %}
<div>
Request URL:http://longcat.de/ccc/28C3-r0ket-tr4cking/v2/debug/proxy.php?rnd=0.8968758655246347
Request Method:GET
Status Code:200 OK
Request Headers
Accept:application/json, text/javascript, */*; q=0.01
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8,de-DE;q=0.6,de;q=0.4
Connection:keep-alive
Host:longcat.de
@ydnax
ydnax / crawler.js
Created October 3, 2011 09:06
humble keycrawler.
var urllib=require("./urllib.js");
var sys=require("sys");
var urlparser=require("url");
var spawn = require('child_process').spawn;
var starturl="http://www.google.com/search?hl=en&q=http%3A%2F%2Fwww.humblebundle.com%2F%3Fkey%3D";
var regex=/www ?\. ?humblebundle ?\. ?com ?\/\?key ?\=\w{2,13}/ig;
var hit=function(url){
//console.log("newurl: "+url);