This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# File: .ebextensions/create_rake_1_caller.config | |
files: | |
/tmp/run_cronjob_1.sh: | |
mode: "000755" # This sets the file as executable | |
owner: root # Set to the appropriate owner | |
group: root # Set to the appropriate group | |
content: | | |
#!/bin/bash | |
# Custom script content goes here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Using Log4j to log messages to a file involves a few steps: | |
1. **Add Dependencies**: If you're using Maven or Gradle, you need to add the required dependencies to your build file. | |
2. **Configure Log4j**: You need to create a Log4j configuration file (like `log4j2.xml`) to specify how logging should be handled, including sending log messages to a file. | |
3. **Use in Code**: Finally, you use Log4j in your Java code to log messages. | |
Let's go through each step: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tables = [] | |
ActiveRecord::Base.connection.tables.each do |t| | |
count = ActiveRecord::Base.connection.exec_query("select count(*) from #{t}").rows[0][0] | |
puts "#{t}, #{count.to_i}" | |
tables << [t, count.to_i] | |
end | |
tables.sort_by { |t| t[1] }.reverse! | |
puts "=====================" | |
ap tables |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM mysql:5.7.37-debian | |
#install ruby | |
RUN apt update | |
RUN apt install -y git | |
RUN git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.11.1 | |
RUN . "/root/.asdf/asdf.sh" | |
RUN asdf plugin add ruby https://github.com/asdf-vm/asdf-ruby.git | |
RUN apt install -y wget | |
RUN apt-get -y install make |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
For NGINX: | |
Show analysis of access.log file | |
goaccess -f /var/log/nginx/access.log --log-format='%h %^[%d:%t %^] "%r" %s %b"%R" "%u" "%f" "%T" "%T" "%T" ' --date-format=%d/%b/%Y --time-format=%T | |
Show analysis of specific route: | |
tail -25000 /var/log/nginx/access.log.1 | grep /webhooks | goaccess --log-format='%h %^[%d:%t %^] "%r" %s %b"%R" "%u" "%f" "%T" "%T" "%T" ' --date-format=%d/%b/%Y --time-format=%T | |
For specific time: >= 5PM <= 8PM, date 12/Jul/2020 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#install python3.5 | |
sudo apt-get install build-essential checkinstall | |
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev | |
cd /usr/src | |
wget https://www.python.org/ftp/python/3.5.6/Python-3.5.6.tgz | |
sudo wget https://www.python.org/ftp/python/3.5.6/Python-3.5.6.tgz | |
sudo tar xzf Python-3.5.6.tgz | |
cd Python-3.5.6 | |
sudo ./configure --enable-optimizations | |
sudo make altinstall |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/ruby | |
require 'json' | |
require 'stringio' | |
# Complete the minimumBribes function below. | |
def minimumBribes(q) | |
too = false | |
bs = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
repositories { | |
maven { url 'https://raw.github.com/applanga/sdk-android/master/maven/releases/' } | |
maven { url 'https://jitpack.io' } | |
} | |
buildscript { | |
repositories { | |
jcenter() | |
google() | |
maven { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#might need to change selector.. | |
for (var i=0; i< $$(".sc-gacfCG").length; i++) console.log(i, $$(".sc-gacfCG")[i].textContent); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tested with `gem 'aws-sdk', '~> 2'` | |
``` | |
@s3 = Aws::S3::Client.new( | |
region: ENV['AWS_REGION'], | |
access_key_id: ENV['AWS_ACCESS_KEY_ID'], | |
secret_access_key: ENV['AWS_SECRET_KEY'] | |
) |
NewerOlder