Skip to content

Instantly share code, notes, and snippets.

@j-alberto
j-alberto / ssd
Last active January 13, 2020 02:30
# see fstrim status
systemctl status fstrim.timer
# temporal files to ram in /etc/fstab
tmpfs /tmp tmpfs noatime,nodiratime,nodev,nosuid,mode=1777,size=1G,defaults 0 0
tmpfs /var/tmp tmpfs noatime,nodiratime,nodev,nosuid,mode=1777,size=1G,defaults 0 0
# add noatime to ssd root partition in /etc/fstab
/dev/mapper/kubuntu--vg-root / ext4 noatime,errors=remount-ro 0 1
/*** update sequences ***/
select setval('seqname',(select max(id) from tablename));
/*** restore backup ***/
psql.exe -h [host] -p [port] -d [database] -U [user] -f "c:\\path\\to\\file"
/*** find tables with FKs to a table ***/
select R.TABLE_NAME,r.constraint_schema
from INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE u
inner join INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS FK
[alias]
cm = commit
mg = merge
br = branch
co = checkout
st = status
lg = log "--pretty=format:'%ad | %s%C(yellow bold)%d%Creset %Cgreen[%an]' --graph --date=short"
@j-alberto
j-alberto / MSSQLServer-dataDictionary.sql
Last active August 30, 2016 18:56
SQLServer - Get data dictionary from all schemas
/******** table descriptions & check constrints ********/
select obj.name
,prop.value
,obj.type_desc
from sys.extended_properties as prop
inner join sys.objects obj on
obj.object_id = prop.major_id
where minor_id = 0
and prop.name = 'MS_Description'
@j-alberto
j-alberto / .git-prompt
Last active June 13, 2016 14:22
git-aware prompt with custom coloring
function _fancy_prompt {
local RED="\[\033[01;31m\]"
local YELLOW="\[\033[01;33m\]"
local BLUE="\[\033[01;34m\]"
local WHITE="\[\033[00m\]"
local GREEN="\[\033[36m\]"
local GREEN2="\[\033[32m\]"
local PROMPT=""
@j-alberto
j-alberto / application.desktop
Last active November 15, 2024 20:46
Very basic ubuntu desktop-file template
[Desktop Entry]
Type=Application
Name=myAppName
Icon=~/myApp/icon.xpm
Exec=~/myApp/launcher
Comment=brief description
Categories=Development;IDE;
Terminal=false