Skip to content

Instantly share code, notes, and snippets.

View nietzscheson's full-sized avatar

Cristian nietzscheson

View GitHub Profile
@nietzscheson
nietzscheson / shell.nix
Created November 18, 2024 18:03
Ollama on Nix
{ pkgs ? import <nixpkgs> {} }:
let
pythonEnv = pkgs.python311.withPackages (ps: [
ps.pip
ps.debugpy
ps.ipython
ps.numpy
ps.setuptools
]);
@nietzscheson
nietzscheson / clickwase-shopify.md
Last active August 13, 2024 13:30
ClickWase pixels implementation in Shopify

ClickWase <3 Shopify pixels implementation

Please read the next:

{% if first_time_accessed %}
  {% if checkout.customer.orders.size > 1 %}
 <img src="https://my.pampanetwork.com/scripts/sale.php?TotalCost={{%20order.total_price%20|%20money_without_currency%20}}&amp;AccountId=e692920c&amp;OrderID={{%20order.order_number%20}}&amp;ActionCode=recurrente&amp;CampaignID=14b4775a&amp;Currency=MXN" width="1" height="1">
{ pkgs ? import <nixpkgs> {} }:
let
pythonEnv = pkgs.python311.withPackages (ps: [
ps.pip
ps.debugpy
ps.ipython
ps.numpy
ps.setuptools
]);
@nietzscheson
nietzscheson / easy_broker_properties.py
Created May 1, 2023 17:20
Easy Broker Properties Gist
import os
import json
import unittest
from unittest.mock import MagicMock
from urllib.request import urlopen, Request
class EasyBrokerPropertiesResponse:
def easy_broker_properties_response(self):
api_key = os.environ["API_KEY"]
@strawberry.federation.type(keys=["id"])
class UserType:
id: strawberry.ID = strawberry.federation.field
@classmethod
def resolve_reference(cls, id: strawberry.ID):
return UserType(id)
@strawberry.federation.type(keys=["id"], description="User Type definition")
class ProductType:
@strawberry.federation.type(keys=["id"], extend=True)
class UserType:
id: strawberry.ID =
@strawberry.federation.type(keys=["id"], description="User Type definition")
class ProductType:
id: strawberry.ID
name: str
@strawberry.field
@nietzscheson
nietzscheson / potencial.py
Last active December 13, 2022 17:55
Show if a exponentiation sum of numbers is False or True with the same input
import unittest
def potencial(numbers: str):
to_split = int(len(numbers) / 2)
to_sum = (int(numbers[0:to_split]) + int(numbers[to_split::])) ** 2
if to_sum == int(numbers):
return True
@nietzscheson
nietzscheson / gitlab-locally.txt
Created July 8, 2022 18:22
Gitlab Locally Test Runner
### .gitlab-ci.yml
image: alpine
test:
script:
- echo "Hello Gitlab-Runner"
### Pull Gitlab Runner image
docker run -d \
--name gitlab-runner \
from functools import reduce
import logging
logger = logging.getLogger(__name__)
def quote(subtotal, vat, payment_quantity):
###
logger.INFO("Create a Quote")
total = subtotal + (subtotal * vat)
###
@nietzscheson
nietzscheson / test_case.py
Created June 30, 2021 15:11
Override MEDIA_ROOT configuration
import graphene
import json
import tempfile
import shutil
from draphene.factory import PostFactory, UserFactory
from django.test import override_settings
from graphene_django.utils.testing import GraphQLTestCase
MEDIA_ROOT = tempfile.mkdtemp()