Structs & functions
#include <stdio.h>
#include <string.h>
int stringsTotalLength(char* firstString, char* secondString) {
int totalLength = strlen(firstString) + strlen(secondString);
return totalLength;
}| kamal deploy | |
| Log into image registry... | |
| INFO [43ba0482] Running docker --version && docker buildx version as chunisan@localhost | |
| INFO [43ba0482] Finished in 0.263 seconds with exit status 0 (successful). | |
| INFO [78be9720] Running docker login -u [REDACTED] -p [REDACTED] as chunisan@localhost | |
| INFO [78be9720] Finished in 3.187 seconds with exit status 0 (successful). | |
| INFO [335cb57f] Running docker login -u [REDACTED] -p [REDACTED] on 150.136.2.200 | |
| INFO [335cb57f] Finished in 3.772 seconds with exit status 0 (successful). | |
| Build and push app image... | |
| INFO [57fe232e] Running docker --version && docker buildx version as chunisan@localhost |
| // TODO: Migrate to AWS Node SDK V3 | |
| const AWS = require('aws-sdk'); | |
| const cloudformation = new AWS.CloudFormation()async function disableTerminationProtection(stackNames) { | |
| for (const stackName of stackNames) { | |
| try { | |
| await cloudformation.updateTerminationProtection({ | |
| EnableTerminationProtection: false, | |
| StackName: stackName, | |
| }).promise(); | |
| console.log(`Termination protection disabled for stack ${stackName}`); |
| # This program was generated by ChatGPT | |
| import numpy as np | |
| # Sigmoid activation function | |
| def sigmoid(x): | |
| return 1 / (1 + np.exp(-x)) | |
| # Derivative of the sigmoid function | |
| def sigmoid_derivative(x): |
| # In config/application.rb | |
| class ResponseLogger | |
| def initialize(app) | |
| @app = app | |
| end | |
| def call(env) | |
| headers = env.select {|k,v| k.start_with? 'HTTP_'} | |
| .map {|pair| [pair[0].sub(/^HTTP_/, ''), pair[1]].join(": ")} |
Structs & functions
#include <stdio.h>
#include <string.h>
int stringsTotalLength(char* firstString, char* secondString) {
int totalLength = strlen(firstString) + strlen(secondString);
return totalLength;
}| # send email using STARTTLS; Net::SMTP#enable_starttls requires ruby >=1.8.7 | |
| # this hack is needed for rails <2.3; apparently >=2.3 has something for this already | |
| ActionMailer::Base.class_eval do | |
| private | |
| def perform_delivery_smtp(mail) | |
| destinations = mail.destinations | |
| mail.ready_to_send | |
| smtp = Net::SMTP.new(smtp_settings[:address], smtp_settings[:port]) |
| #! /bin/sh | |
| ### BEGIN INIT INFO | |
| # Provides: redis-server | |
| # Required-Start: $syslog $remote_fs | |
| # Required-Stop: $syslog $remote_fs | |
| # Should-Start: $local_fs | |
| # Should-Stop: $local_fs | |
| # Default-Start: 2 3 4 5 | |
| # Default-Stop: 0 1 6 | |
| # Short-Description: redis-server - Persistent key-value db |
| { | |
| "_json" => [{ | |
| "email" => "[email protected]", | |
| "timestamp" => 1540907117, | |
| "status" => "4.3.0", | |
| "reason" => "maildrop: maildir over quota.", | |
| "sg_message_id" => "kxRB0RumSp6z8tkmLZnUMQ.filter0176p3mdw1-22850-5BD1C50F-7C.0", | |
| "sg_event_id" => "QcLgvoOaRWCXLZ72J-lf1g", | |
| "type" => "blocked", | |
| "event" => "bounce" |
| # Install imagemagick first | |
| # brew install imagemagick | |
| require "shellwords" | |
| photos_dir = "ENV['Home']/Downloads/Photos to Upload" | |
| Dir["#{photos_dir}/**/*"].each do |file_path| | |
| system("mogrify -strip #{Shellwords.shellescape(file_path)}") | |
| end |