Posts by Bruno Coimbra • 1,052 points
31 posts
-
-1
votes1
answer207
viewsQ: How to extract the public key from a certificate . pem to use with openssh
I have a private key rsa formatted as PEM issued by Amazon’s key generation service (AWS). I need to extract the public key from the private key to use in the file ~/.ssh/authorized_keys in other…
-
0
votes1
answer207
viewsA: How to extract the public key from a certificate . pem to use with openssh
To extract the public key, use the command ssh-keygen as below: ssh-keygen -f chave_privada.pem -y > chave_publica.pub
-
0
votes1
answer74
viewsA: How to copy the largest folder file to another using bash shell?
With the help of some commands, you can find the biggest file like this: find . -type f -printf "%s %p\n" | sort -n | tail -n1 | cut -f 2 -d' ' Halving: find . -type f -printf "%s %p\n" finds all…
-
2
votes2
answers130
viewsA: How can I turn " to " in a bash script
write your script as follows: #!/bin/bash pyprog=$(cat $1) # Salva nessa variável o texto do arquivo python echo "#!/bin/bash echo \"$(echo $pyprog | sed 's/"/\\"/g')\" | python" > $2 The command…
-
0
votes1
answer83
viewsA: Postgresql - Trying a rollback in a function
According to this OS post (https://stackoverflow.com/questions/12778209/are-postgresql-functions-transactional), functions inherit the behavior of the transaction in which they were called. If the…
-
0
votes2
answers1889
viewsQ: How to extract the public key from a certificate . pem with Openssl
The command below generates a certificate .pem (equal to those used by AWS): openssl genrsa -des3 -out chaveprivada.pem 2048 However public and private keys are stored together in the archive. How…
-
0
votes2
answers1889
viewsA: How to extract the public key from a certificate . pem with Openssl
To extract the key from a file .pem use the command below: openssl rsa -in chaveprivada.pem -pubout > chavepublica.pub The public key will be written in the file chavepublica.pub.…
-
1
votes2
answers1789
viewsA: Where does the Git pull point?
perform a git remote -v that it will show the association where the data comes from. origin is a nickname that the git gives to a remote repository when it is cloned.…
gitanswered Bruno Coimbra 1,052 -
0
votes1
answer241
viewsA: FIREBASE WARNING: Using an unspecified index
As we speak by the comments, add something like: { "rules": { "motoristas": { ".indexOn": ["nombre"] } } } in its rules must resolve. Source:…
-
2
votes2
answers539
viewsA: Docker during the development
Add the key -v command that starts the Docker container (docker run). This option cannot be included in Dockerfile to maintain the portability of environments. Use with the syntax: -v…
dockeranswered Bruno Coimbra 1,052 -
4
votes1
answer711
viewsA: Create a patch from a commit
As quoted in the question comments, just use the command git format-patch according to the git manual, it can be used in many ways, but I believe the main ones are: git format-patch…
gitanswered Bruno Coimbra 1,052 -
0
votes1
answer35
viewsA: request for support in optimization, fix shell command for mac
use the rsync rsync -av xx1/ xx2/
-
1
votes2
answers36
viewsA: Removal of string in script
with a sed-only command you can remove all escape sequences from the terminal as follows: sed 's/\^\[\[[^m]\+m//g' <seu_arquivo> in sed, characters that have meaning in Regular Expressions…
-
0
votes1
answer34
viewsA: Receive and convert stream from remote server to string
To convert the stream to string you can use the following one-Liner: "<seu stream hex>".split('').each_slice(2).map {|char| char.join.hex.chr }.join is not an elegant solution, but is…
rubyanswered Bruno Coimbra 1,052 -
2
votes1
answer120
viewsA: Add Time by converting to Ruby for seconds
If the problem is performance, would do the operation directly in BD: Ticket.average("updated_at - created_at") If there are other conditions it gets something like: Ticket.where(<suas…
-
4
votes1
answer266
viewsQ: How do I send a message to stderr no bash via echo command?
I’m writing some script to deploy an application and need to send status messages to stderr instead of stdout, that command echo makes by default. How to do the command echo send the message to…
-
1
votes1
answer68
viewsA: Vagrant box error
In the log you reported, Vagrant is looking for 32bit packages, but the repository that is configured to update Ubuntu packages provides only 64bit packages. The next line is what appears in your…
ruby-on-railsanswered Bruno Coimbra 1,052 -
1
votes1
answer262
viewsA: How to authenticate with Devise via AJAX?
I would make a request for the page that generates the login form by ajax. Then, just send a second request with the data informed by the user, not forgetting the tokens to avoid CSRF (and any other…
-
0
votes2
answers199
viewsQ: How to check if a provider is on . ssh/known_hosts?
I have a script that synchronizes git repositories. If the repository has never been synchronized, directories are created. Eventually, when a repository is added, the server serving the repository…
-
4
votes2
answers199
viewsA: How to check if a provider is on . ssh/known_hosts?
Just run the command ssh-keygen -H -F <hostname>. The command returns the line the hostname is included in, or returns nothing if it does not find.
-
1
votes1
answer93
viewsA: Abstractcontroller::Actionnotfound for the Destroy action
the end-point that is called in the code snippet <script language="javascript"> $("#newChance").on('click', function() { $("#linkNewChance").attr('href', '/managers/recruitments/<%=…
-
4
votes2
answers255
viewsA: How is it different to declare a variable with and without "@" in Ruby?
the variables they have @ are instance variables in the current object scope. the variables without @ are local variables in the current object scope. In the specific case of Rails, the variables…
-
3
votes3
answers6757
viewsA: How do I round up a value from 39.54 to 39
information about the types of data you are dealing with is missing, but let’s see what we can do: If its numeric value is of type Float only one parseInt(39.54) must solve. If it is a string,…
javascriptanswered Bruno Coimbra 1,052 -
4
votes5
answers7529
viewsA: How to search recursively using grep
You can also use the option -exec of find together with the grep. If there is a need to filter the files with the find the option below will be faster than grep -r, because will not try to search…
-
4
votes5
answers2467
viewsA: Is it feasible to define mandatory fields in the application instead of the database?
This is a very controversial subject, especially among people who develop software for the web. Some prefer to leave everything in the application, others share responsibility. Personally I believe…
-
1
votes1
answer151
viewsA: Error while initializing Redmine
Your translation file is not properly formatted as per the YAML format specification. Look for missing spaces, incorrect identations or things like that. If you can, post your translation file to…
-
0
votes2
answers195
viewsA: Carrierwave - destroy object only after it has been deleted from my storage
For me, it makes more sense to call remove_avatar! before calling the object.destroy. Thus, you can always ensure that you will not have orphaned objects in S3, checking whether the object has…
-
3
votes2
answers182
viewsA: Should old tags and branches be deleted from the remote repository?
I prefer to keep my repositories as clean as possible. In this way, I try to apply the following rules: Branches that have code that will not be used are deleted. Are unfinished features, or test…
gitanswered Bruno Coimbra 1,052 -
1
votes2
answers126
viewsA: Ruby application that keeps reloading source files
I would do two things to get this behavior: It would include a Signalhandler to capture some signal from the operating system, such as USR1 (whereas vc is in a *UNIX). And whenever the process…
rubyanswered Bruno Coimbra 1,052 -
25
votes4
answers1969
viewsA: How to save Ctrl+S to Vim?
Ctrl-S is a shortcut to enable terminal scroll-lock since terminals were slower in displaying characters than operators in typing them. To turn off the scroll-lock, simply press Ctrl-Q. As the need…
vimanswered Bruno Coimbra 1,052 -
13
votes4
answers1446
viewsA: Load file to current directory when running irb
For Ruby versions starting from 1.9.x, it is necessary to pass the full path of the file, either relative, or absolute, as the current directory has been removed from the LOAD_PATH, then it is…