Structs & functions
#include <stdio.h>
#include <string.h>
int stringsTotalLength(char* firstString, char* secondString) {
int totalLength = strlen(firstString) + strlen(secondString);
return totalLength;
}
# 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" => "lovis@tinybuddy.se", | |
"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 |
Login to Hetzner's web interface https://robot.your-server.de/ and activate the Rescue System for the server whose disk you wish to clone.
Ssh into the Rescue System (Replace 1.2.3.4
in the command below with the actual ip address of the server)
ssh -o HostKeyAlias=hetzner-rescue.1.2.3.4 root@1.2.3.4