Skip to content

Instantly share code, notes, and snippets.

@lennardv2
lennardv2 / archivedl.php
Created June 1, 2023 13:39 — forked from divinity76/archivedl.php
Fork of archivedl.php to make it work with php8.2
#!/usr/bin/php
<?php
declare(strict_types = 1);
// require_once ('hhb_.inc.php');
hhb_init ();
if ($argc !== 3) {
fprintf ( STDERR, "usage: %s timestamp url\n", $argv [0] );
fprintf ( STDERR, "example: %s 20091012061648 http://www.p4w.se\n", $argv [0] );
die ( 1 );
}
@bhavsarpratik
bhavsarpratik / gpt3_inference.py
Last active February 16, 2024 13:12
OpenaAI GPT3 inference
# pip install openai retry
import openai
from retry import retry
model="curie:ft-xxx-2021-01-09-19-21-20
@retry(Exception, tries=3, delay=10)
def get_gpt_reason(prompt, model, prob=False, max_tokens=10):
@1844144
1844144 / create_entry.php
Last active May 30, 2023 14:09
Formidable Forms: Create Entry, Update metas for existing entry
<?
$arg = array(
'form_id' => $opts['subscription_form'],
'item_key' => FrmAppHelper::get_unique_key(
'', $pre . 'frm_items', 'item_key', 0 ),
'item_meta' => array(
$opts['subscription_id'] => $payment->response->getSubscriptionId(),
$opts['subscription_pre_payment_id'] => $payment->entry->id,
$opts['subscription_date'] => $metas[$opts['recur_date']],
$opts['subscription_amount'] => $metas[$opts['recur_amount']],
#!/usr/bin/php
<?php
declare(strict_types = 1);
// require_once ('hhb_.inc.php');
hhb_init ();
if ($argc !== 3) {
fprintf ( STDERR, "usage: %s timestamp url\n", $argv [0] );
fprintf ( STDERR, "example: %s 20091012061648 http://www.p4w.se\n", $argv [0] );
die ( 1 );
}
@AlexSkrypnyk
AlexSkrypnyk / mymodule.css
Last active April 17, 2024 08:37
Drupal 'add more' and 'remove single' AJAX buttons on multi value custom field using FormAPI
input.form-submit.button-small {
padding: 4px 8px;
font-weight: bold;
}
.container-inline input.form-submit.button-small + .ajax-progress.ajax-progress-throbber .throbber {
position: absolute;
left: 19px;
margin-top: 7px;
}
@saltlakeryan
saltlakeryan / example_formidable_query.php
Created September 15, 2015 21:02
pull csv from formidable forms with php
<?php
function get_form_entries($baseurl, $username, $password, $uid, $formid) {
$headerfile = tempnam("/tmp", "formidable-header");
$cookiefile = tempnam("/tmp", "formidable-cookie");
$csvfile = tempnam("/tmp", "formidable-csv");
$login_cmd = "curl -s -D $headerfile -c $cookiefile 'http://$baseurl/wp-login.php' --data 'log=$username&pwd=$password&testcookie=1' -H 'Cookie: wp-settings-time-$uid=2829600000; wordpress_test_cookie=WP+Cookie+check' 2> /dev/null";
$pull_csv_cmd = "curl -s -D $headerfile -b $cookiefile -o $csvfile -c $cookiefile 'http://$baseurl/wp-admin/admin-ajax.php?frm_action=0&action=frm_entries_csv&form=$formid'";
exec($login_cmd, $output, $status);
if ($status != 0) {
throw new Exception("Can't login");
//
// NaturalMotion.swift
//
// Created by Maciej Swic on 2014-06-06.
// Released under the MIT license.
//
import UIKit
extension UIView {
@chrislkeller
chrislkeller / import_json_appsscript.js
Last active March 25, 2024 19:45
Adds what amounts to an =ImportJSON() function to a Google spreadsheet... To use go to Tools --> Script Editor and add the script and save.
/**
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();