Skip to content

Instantly share code, notes, and snippets.

View foxtacles's full-sized avatar
🏠
Working from home

Christian Semmler foxtacles

🏠
Working from home
View GitHub Profile
@foxtacles
foxtacles / gist:cbf11160ffd6152b48321c57143639f3
Last active December 9, 2023 14:31
Some ideas for extra tooling

Names, syntax etc. are just placeholders for illustration.

interleave

This tool takes a .cpp file, finds the first and the last function annotation in the file, then searches the entire codebase and "interleaves" all functions that appear between the first/last function in the .cpp file, based on their offset/address.

Could optionally also prepend/append functions before/after the first/last function in case of "reasonable" offset gap.

The output is the .cpp file with "comment syntax"-style function annotations interleaved between the functions where they belong, so that checkorder would still pass on the .cpp file.

#include <unordered_map>
#include <rapidjson/schema.h>
typedef std::unordered_map<std::string, rapidjson::SchemaDocument> SchemaCollection;
class SchemaDocumentProvider : public rapidjson::IRemoteSchemaDocumentProvider {
SchemaCollection* schema_collection;
public:
SchemaDocumentProvider(SchemaCollection* schema_collection) : schema_collection(schema_collection) { }
development:
adapter: postgresql
encoding: unicode
host: localhost
database: robot
username: foxtacles
password: foxtacles
pool: 20
timeout: 10000
ActiveRecord::Base.transaction {
30000.times {
g = GlobalProduct.create;
g.global_product_codes.create(code_type: "asin", code: SecureRandom.hex).app_product_prices.create(source: "amazon", base_price: 4, full_price: 5, fetched_at: Date.today)
g.global_product_codes.create(code_type: "gtin", code: SecureRandom.hex).app_product_prices.create(source: "gshopping", base_price: 2, full_price: 3, fetched_at: Date.today)
} }
k;double sin()
,cos();main(){float A=
0,B=0,i,j,z[1760];char b[
1760];printf("\x1b[2J");for(;;
){memset(b,32,1760);memset(z,0,7040)
;for(j=0;6.28>j;j+=0.07)for(i=0;6.28
>i;i+=0.02){float c=sin(i),d=cos(j),e=
sin(A),f=sin(j),g=cos(A),h=d+2,D=1/(c*
h*e+f*g+5),l=cos (i),m=cos(B),n=s\
in(B),t=c*h*g-f* e;int x=40+30*D*
invoice.transactions.sum(:total) Netto
invoice.total_with_vats - Netto + VATS + Marge abzgl. Gutschein
invoice.total_without_vats - Netto + Marge abzgl. Gutschein
invoice.margin_only Marge-Anteil von obigem
invoice.vats_only VATS-Anteil von obigem
invoice.total_without_vats - invoice.margin_only
=> Netto abzgl. Gutschein
b1 = BillingChecker.new(coupon: 0, vat: 1, margin: 1, first_date: DateTime.parse("2013-09-01"), end_time: DateTime.parse("2013-09-30"))
b2 = BillingChecker.new(coupon: 0, vat: 1, margin: 1, first_date: DateTime.parse("2013-10-01"), end_time: DateTime.parse("2013-10-31"))
b1.perform
b2.perform
result = b2.totals.map do |u|
uo = User.find_by_email u[:email]
us = b1.totals.detect{|t|t[:email] == u[:email]}
rc = us[:net_total] - User::DEFAULT_CREDIT
rc = rc > 0 ? 0 : (rc * -1)
Backend liefert Bitfeld:
0x0001 - Grosse Auswahl
0x0002 - Guenstige Preise
0x0004 - Keine Versandkosten
0x0008 - Schnelle Lieferung
0x0010 - Hohe Qualitaet
0x0020 - Marktfuehrer
systems = {"bedundmore.de" => "Gambio", "closed.de" => "OXID", "schuhxl.de" => "Plentymarkets", "skapetze.com" => "xt:Commerce", "shop.ear-band-it.de" => "Afterbuy", "gadsumo.de" => "Magento", "musterbrand.com" => "Shopware", "kern-sohn.com" => "Cosmoshop", "ubercartdemo.com" => "Ubercart", "dirtyshirty.com" => "PrestaShop", "liftstation.eu" => "JTL Shop", "outdoorbilliger.de" => "XANARIO", "flairie.de" => "Smartstore"}
systems.each do |k,v|
scraper = ShopsystemScraper.new(:website_url => k)
scraper.run
if scraper.shopsystem != v
puts v
puts scraper.shopsystem
render nothing: true, status: 422
return