This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import models | |
from django.contrib.auth.models import User | |
from django.db.models.signals import post_save | |
# ------------- USERS ------------- | |
class UserProfile(models.Model): | |
user = models.OneToOneField(User) | |
def __unicode__(self): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fib(): | |
first = 0 | |
second = 1 | |
while True: | |
cached = first | |
first = first + second | |
second = cached | |
yield first | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from subprocess import call | |
from bs4 import BeautifulSoup | |
import json | |
import os | |
def get_html(): | |
if os.path.isfile('richard-family-fund'): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
''' | |
archive.py | |
Quick and dirty script that moves desktop clutter to a date-sorted archive | |
location. Nothing elegant here, just keeps desktop workspace much less | |
cluttered. Intended to be run as a cron job at a sane frequency. | |
Usage is ideal if your desktop is merely a swap space, not so ideal if your |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var me = new Person(); | |
var d_day = setInterval(function(){ | |
if (me.age == 30) { | |
console.log('fuck my life'); | |
shuffle_off(me.mortal_coil); | |
clearTimeout(d_day); | |
} | |
}, 86400e1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Note: If you're serving files via shared folders, for christs sake use NFS | |
# but that does require private networking. | |
# | |
# The DNS settings were the ones that made the most difference, so if you're resource | |
# constrained, the last two settings were the ones that helped the most. | |
config.vm.provider :virtualbox do |vb| | |
vb.customize ["modifyvm", :id, "--memory", "1024"] | |
vb.customize ["modifyvm", :id, "--cpuexecutioncap", "90"] | |
vb.customize ["modifyvm", :id, "--cpus", 2] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Sourced from https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Storage | |
// | |
// Note: The maximum size of data that can be saved is severely restricted by the use of cookies. | |
// With this algorithm, use the functions localStorage.setItem() and localStorage.removeItem() to add, | |
// change, or remove a key. The use of methods localStorage.yourKey = yourValue; and delete localStorage.yourKey; | |
// to set or delete a key is not a secure way with this code. You can also change its name and use it only to | |
// manage a document's cookies regardless of the localStorage object. | |
if (!window.localStorage) { | |
Object.defineProperty(window, "localStorage", new (function () { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var score = 0; | |
Object.defineProperty( this, 'score', { | |
get: function(){ | |
return score; | |
}, | |
set: function( val ) { | |
score = val; | |
this.elem.innerHTML = _.template( | |
tmplStr, { score: score } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const immutable = require('./immutable'); | |
let obj; | |
obj = immutable({ foo: 'bar' }); | |
obj.foo = 'baz'; // assignment fails silently | |
delete obj.foo; // delete fails silently | |
obj = immutable({ foo: [ 1, 2, 3 ] }); | |
obj.foo.push( 4 ); // mutation fails silently |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding=utf-8 | |
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software |