:%!python -m json.tool
Requires python to be installed. This command can also be stored in a macro in .vimrc
:
function! FormatJSON()
:%!python -m json.tool
endfunction
solution = 0 | |
(1...1000).each do |n| | |
if n % 3 == 0 or n % 5 == 0 | |
solution += n | |
end | |
end | |
solution |
# Remove unused gems, clean up broken dependencies | |
# Use with bundle show <gem> to resolve LoadError problems for gems that are installed but not seen by Rails | |
gem clean <gem> | |
# Remove accumulated gem documentation (ri and rdoc) | |
rm -r `gem env gemdir`/doc |
# List all the gems and versions used in your rails project | |
bundle show | |
# Use this to list an individual gem's location. Note that the regular "bundle show" doesn't tell you when a dependency is broken | |
bundle show <gem> | |
# Perform "bundle show <gem>" but for all the gems | |
bundle show | sed -e 's/ \* //g' | sed -e 's/ (.*//g' | xargs -I {} bundle show {} | |
# Try using bundle install |
# Find the MD5 sum of the current directory | |
find . -type f -not -path "./.git/*" -print0 | xargs -0 md5 | md5 |
$.getScript("http://url/to/javascript.js", function () { | |
// Do something here. This will be safe to call after asynchronous script load | |
}); |
import org.gradle.logging.StyledTextOutput; | |
import org.gradle.logging.StyledTextOutputFactory; | |
import static org.gradle.logging.StyledTextOutput.Style; | |
StyledTextOutput o = services.get(StyledTextOutputFactory).create("test string") | |
task taskname << { | |
o.withStyle(Style.Description).append("Hello world!") | |
// Style.?? Can be normal, header, userinput, identifier, description, progressstatus, failure, info, or error | |
} |
#Put this in the nginx.conf file. You may need to add "index index.php" under the server block. | |
location / { | |
try_files $uri $uri/ /index.php?$args; | |
} |
#!/bin/bash | |
# | |
# Report time to first byte for the provided URL using a cache buster to ensure | |
# that we're measuring full cold-cache performance | |
while (($#)); do | |
echo $1 | |
curl -so /dev/null -H "Pragma: no-cache" -H "Cache-Control: no-cache" \ | |
-w "%{http_code}\tPre-Transfer: %{time_pretransfer}\tStart Transfer: %{time_starttransfer}\tTotal: %{time_total}\tSize: %{size_download}\n" \ | |
"$1?`date +%s`" |
After updating pg_hba.conf or postgresql.conf, the server needs the config needs to be reloaded. The easiest way to do this is by restarting the postgres service:
service postgresql restart
When the service
command is not available (no upstart on Synology NAS, for example), there are some more creative ways to reload the config. Note this first one needs to be done under the user that runs postgres (usually the user=postgres
).
user# sudo su postgres
postgres# pg_ctl reload