Skip to content

Instantly share code, notes, and snippets.

View SammyLin's full-sized avatar
:octocat:
大家好

Sammy Lin SammyLin

:octocat:
大家好
View GitHub Profile
@Kartones
Kartones / postgres-cheatsheet.md
Last active November 2, 2024 03:58
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@dhrrgn
dhrrgn / gist:10125477
Last active February 26, 2021 18:42
Upgrade Ubuntu OpenSSL to patch Heartbleed
sudo apt-get update
sudo apt-get install -y libssl1.0.0 openssl
# Confirm Build Date is at least Aril 7th 2014
openssl version -a
# Restart all services listed by this command:
sudo lsof -n | grep ssl | grep DEL
@basti
basti / application.rb
Last active March 1, 2021 10:42 — forked from keighl/application.rb
Local Rails 4 assets precompilation using Capistrano 3 and rsync
# Speed things up by not loading Rails env
config.assets.initialize_on_precompile = false
@Adirael
Adirael / fix-wordpress-permissions.sh
Created August 17, 2012 23:16
Fix wordpress file permissions
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org>
#
WP_OWNER=www-data # <-- wordpress owner
WP_GROUP=www-data # <-- wordpress group
WP_ROOT=$1 # <-- wordpress root directory
@gudata
gudata / _page.html.slim
Created July 18, 2012 14:41
Easy implementation of nestedSortable with rails preserving the sort order http://mjsarfatti.com/sandbox/nestedSortable/
- class_for_root_only = ((root_ol rescue true) ? 'sortable' : @first_call = '')
ol class=class_for_root_only data-sort-url=sort_website_pages_path(@website)
li id="list_#{page.id}"
.handle
= link_to page.name, edit_website_page_path(@website, page)
'
= active_icon(page, :published)
.btn-group.pull-right
= link_to t('View'), website_page_path(@website, page), :class => 'btn btn-mini'
@xdite
xdite / gist:3072362
Created July 8, 2012 19:10
deploy/asset.rb
# -*- encoding : utf-8 -*-
set :assets_dependencies, %w(app/assets lib/assets vendor/assets Gemfile.lock config/routes.rb)
namespace :deploy do
namespace :assets do
desc <<-DESC
Run the asset precompilation rake task. You can specify the full path \
to the rake executable by setting the rake variable. You can also \