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
import asyncdispatch, asynchttpserver, asyncnet, nativesockets, net | |
import logging, oids, strformat, strutils, tables, times | |
#import sse_db | |
type SSEClient = object | |
fs: FutureStream[string] | |
clientClosed: int | |
req: Request | |
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 |
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
import cv2 | |
def paddedzoom(img, zoomfactor=0.8): | |
''' | |
Zoom in/out an image while keeping the input image shape. | |
i.e., zero pad when factor<1, clip out when factor>1. | |
there is another version below (paddedzoom2) | |
''' |
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
#!/bin/sh -e | |
### BEGIN INIT INFO | |
# Provides: vncserver | |
# Required-Start: networking | |
# Required-Stop: networking | |
# Default-Start: 3 4 5 | |
# Default-Stop: 0 6 | |
### END INIT INFO | |
PATH="$PATH:/usr/X11R6/bin/" |
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
// ==UserScript== | |
// @name BitTube No Offline TIMER | |
// @namespace http://tampermonkey.net/ | |
// @version 1.0.3 | |
// @description BitTube Never Stop Ever Again | |
// @author ReaperBot | |
// @updateURL https://raw.githubusercontent.com/Ngkolo123/js/master/coba2.js | |
// @downloadURL https://raw.githubusercontent.com/Ngkolo123/js/master/coba2.js | |
// @match *.bit.tube/* | |
// @grant none |
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
// ==UserScript== | |
// @name BitTube No Offline TIMER | |
// @namespace http://tampermonkey.net/ | |
// @version 1.0.3 | |
// @description BitTube Never Stop Ever Again | |
// @author ReaperBot | |
// @updateURL https://raw.githubusercontent.com/Ngkolo123/js/master/coba2.js | |
// @downloadURL https://raw.githubusercontent.com/Ngkolo123/js/master/coba2.js | |
// @match *.bit.tube/* | |
// @grant none |
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 import template | |
register = template.Library() | |
@register.filter | |
def titlefirst(value): | |
import re | |
s = re.sub("(^|\s)(\S)", repl_func, value) | |
return s |
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
# Example based on http://lukeplant.me.uk/blog/posts/djangos-cbvs-were-a-mistake/ | |
# Not tested, just designed to give a general idea of the games CBVs let you play | |
from django.core.urlresolvers import reverse_lazy | |
from django.views.generic.edit import ProcessFormView | |
# Utilities for interacting with a user | |
class UserViewMixin(object): | |
_high_priority_user = None | |
@property |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
""" | |
Example of setting up CORS with Bottle.py. | |
""" | |
from bottle import Bottle, request, response, run | |
app = Bottle() | |
@app.hook('after_request') | |
def enable_cors(): | |
""" |
NewerOlder