View dispatch_openai_requests.py
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 openai | |
import asyncio | |
from typing import Any | |
async def dispatch_openai_requests( | |
messages_list: list[list[dict[str,Any]]], | |
model: str, | |
temperature: float, | |
max_tokens: int, | |
top_p: float, |
View Reachability.h
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
/* | |
File: Reachability.h | |
Abstract: Basic demonstration of how to use the SystemConfiguration Reachablity APIs. | |
Version: 2.2 - ARCified | |
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc. | |
("Apple") in consideration of your agreement to the following terms, and your | |
use, installation, modification or redistribution of this Apple software |
View readme.md
Klipper mesh on print area only install guide
What this macro do
- This macro will dymanic change the bed_mesh area based on the size of the printed part. The fw will only probe on the area that the part will be printed (plus mesh_area_offset value)
Setup guide
- (1) Add the following macrro to your printer config, this will replace the default
BED_MESH_CALIBRATE
command.
View gist:1085628
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
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; | |
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; | |
[nc addObserverForName:UIDeviceOrientationDidChangeNotification object:nil | |
queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notif){ | |
UIDeviceOrientation orientation; | |
orientation = [[UIDevice currentDevice] orientation]; | |
if (UIDeviceOrientationIsPortrait(orientation)) { | |
NSLog(@"portrait"); | |
} else { | |
NSLog(@"landscape"); |
View psextendscriptexample.js
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
/* | |
The original files are 960x319. | |
Image sizes to save: | |
* 800x266 - Retina for 480x320 resolution (400 logical pixel wide panel areas) | |
* 740x246 - Desktop and iPad | |
* 616x205 - Retina for 320x480 resolution (308 logical pixel wide panel areas) | |
* 400x133 - 480x320 resolution | |
* 308x102 - 320x480 resolution |
View NSString+Soundex.h
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
@interface NSString (Soundex) | |
- (NSString*) soundexString; | |
- (BOOL) soundsLikeString:(NSString*) aString; | |
@end |
View knapsack_problem.scala
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 knapsack_aux(x: (Int, Int), is: List[Int]): List[Int] = { | |
for { | |
w <- is.zip(is.take(x._1) ::: is.take(is.size - x._1).map(_ + x._2)) | |
} yield math.max(w._1, w._2) | |
} | |
def knapsack_rec(xs: List[(Int, Int)], is: List[Int]): List[List[Int]] = { | |
xs match { | |
case x :: xs => knapsack_aux(x, is) :: knapsack_rec(xs, knapsack_aux(x, is)) | |
case _ => Nil |
View durationFromMillisToHumanReadable.scala
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 durationFromMillisToHumanReadable(duration: Long):String = { | |
val milliseconds = duration % 1000L | |
val seconds = (duration / 1000L) % 60L | |
val minutes = (duration / (1000L*60L)) % 60L | |
val hours = (duration / (1000L*3600L)) % 24L | |
val days = (duration / (1000L*86400L)) % 7L | |
val weeks = (duration / (1000L*604800L)) % 4L | |
val months = (duration / (1000L*2592000L)) % 52L | |
val years = (duration / (1000L*31556952L)) % 10L | |
val decades = (duration / (1000L*31556952L*10L)) % 10L |
View freebase_ner.py
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 | |
from __future__ import division | |
import nltk | |
import re | |
import requests | |
# Add your freebase key here | |
# If you don't have one, register at https://code.google.com/apis/console | |
FREEBASE_KEY = "" |
NewerOlder