Skip to content

Instantly share code, notes, and snippets.

import csv
import requests
import time
from datetime import datetime
# Define constants
API_URL = "https://ACCOUNT.getdx.net/api/deployments.create"
BEARER_TOKEN = "token"
# Function to convert datetime to Unix timestamp
# app/services/dx_event_sender.rb
require 'net/http'
require 'uri'
require 'json'
class DxEventSender
DX_API_URL = 'https://api.getdx.com/events.track'
def initialize(event_name, user_email, timestamp = Time.now.to_i)
using System;
using System.Collections.Generic;
using System.Data;
using System.Net.Http;
using System.Text.Json;
using System.Threading.Tasks;
using Npgsql;
using System.IdentityModel.Tokens.Jwt;
using Microsoft.IdentityModel.Tokens;
using System.Security.Cryptography;
import os
import jwt # PyJWT
import requests
import pandas as pd
from dotenv import load_dotenv
from datetime import datetime, timedelta
import time
# Load environment variables
load_dotenv()
#!/bin/bash
# Initial URL for the groups endpoint with pagination (max 100 items per page)
base_url='https://git.ws.cgm.com/api/v4/groups?per_page=100'
# Authentication token and proxy setup
token='cgmglpat-fL<TOKEN REMOVED>HHz'
proxy="http://$DX_PROXY_USER:[email protected]:80"
# Initialize variables
#!/bin/bash
# Initial URL with pagination parameters (max 100 items per page)
base_url='https://<Gitlab-BaseURL>.com/api/v4/projects?per_page=100'
# Authentication token and proxy setup
token='cgmglpat-TOken'
proxy="http://$DX_PROXY_USER:[email protected]:80"
# Initialize variables
const { Client } = require('pg');
const axios = require('axios');
// Debug mode
const debug = true; // Set to false for real API calls
// Database connection string
const connectionString = '[CONNECTION STRING FROM DX]';
// DX API endpoint and token
import os
import requests
import jwt
import time
# Load environment variables
app_id = os.getenv('GITHUB_APP_ID')
private_key_file = os.getenv('GITHUB_RSA_PRIVATE_KEY_PATH')
with open(private_key_file, 'r') as f:
import os
import requests
import pandas as pd
from dotenv import load_dotenv
from datetime import datetime
import time
# Load environment variables
load_dotenv()
import csv
# Function to generate insert statements from CSV data and write them to a SQL file
def generate_insert_statements(csv_file_path, output_sql_file):
insert_statements = []
with open(csv_file_path, 'r') as file:
reader = csv.DictReader(file)
with open(output_sql_file, 'w') as sql_file:
for row in reader:
namespace = row['namespace']