Skip to content

Instantly share code, notes, and snippets.

# shortform git commands
alias g='git'
# remove .DS_Store from the repository you happen to staging by mistake
find . -name .DS_Store -exec git rm --ignore-unmatch --cached {} +
# Delete all local branches that have been merged into HEAD.
git branch -d `git branch --merged | grep -v '^*' | grep -v 'master' | tr -d '\n'`
# Credit an author on the last commit
#!/bin/sh
# Sublime Text 3 install with Package Control
# http://simonewebdesign.it/blog/install-sublime-text-3-on-fedora-20/
# Run this script with:
# $ curl LINK_TO_THIS_SCRIPT | sh
curl -o ~/st3.tar.bz2 http://c758482.r82.cf2.rackcdn.com/sublime_text_3_build_3059_x64.tar.bz2
@nyxz
nyxz / server-check.sh
Created October 3, 2014 12:57
This is a script to check if your servers are up and running by using curl to get the status code from the response.
#!/bin/bash
#==========================================================
# This script checks if your servers are up and running. If
# server is down it sends an email to the email(s) listed in
# $EMAIL.
# The script requires you to have `mailx` setup.
#==========================================================
# Set connect timeout to 1min
@nyxz
nyxz / gist:e7b459f5f2f64aa09cf7
Created January 25, 2016 09:28 — forked from ktoso/gist:708972
eclipse formatter pre-commit hook
#!/bin/sh
#
# This hook will run the eclipse code formatter before any commit
# to make the source look as it's supposed to look like in the repo.
ECLIPSE_HOME=$HOME/eclipse
STYLE_FILE=$HOME/org.eclipse.jdt.core.prefs
echo "Running pre-commit hook: run-eclipse-formatter---------------------"
echo "Will run eclipse formatter, using: $STYLE_FILE"
echo "Listing folders to run formatter on… "
@nyxz
nyxz / 90-nproc.conf
Created June 2, 2016 14:17
One time I started getting OutOfMemory: Cannot create native thread exception. This was due to limitation (for processes and threads) of my Fedora system which are set per user. The following configuration saved my day.
# For Fedora this file is located in /etc/security/limits.d
# Default limit for number of user's processes to prevent
# accidental fork bombs.
# See rhbz #432903 for reasoning.
* soft nproc 1024
root soft nproc unlimited
# Those are the limits set for my user 'nyxz' that I added to solve my problem.
# Това за записки на Н. Георгиев от курса по
# GNU/Linux system and network administration - A. Velin
# Записките са правени в лекциите по слайдове, затова на места има само нахвърляни някакви точки, именца и т.н.
# Сиреч още много има за четене, което не е записано тук.
# Също така не претендирам, че съм записал точно всичко, така че не разчитайте на 100% на записките.
# Местата с въпросителни ???? значат, че не съм записал нещо от слайдовете най-вероятно.
Unix -многозадачна потребителска ОС- 1969 :Започва като страничен проект след провала на Multix. Съзаден от Ken Thompsom, Denis Ritchie, Brain Kernighan. 1973 Unix е пренаписан на C.
@nyxz
nyxz / notes-lmde-with-lvm-on-luks.txt
Created June 15, 2016 16:52 — forked from seanorama/notes-lmde-with-lvm-on-luks.txt
Install LMDE (Linux Mint Debian Edition) with LVM on LUKS (encryption) & hibernation support
# Title: Install LMDE (Linux Mint Debian Edition) 17 with LVM on LUKS (encryption) & hibernation support
#
# Description: These are very rough notes for installing LMDE with
# encryption via LVM on top of LUKS.
# - This includes SWAP being within LUKS
# - Includes fixing hibernation (which will also apply to Debian Jessie or greater)
########
# 1. Boot from LMDE DVD/USB/...
##########################################
# To run:
# curl -sSL https://gist.githubusercontent.com/sirkkalap/e87cd580a47b180a7d32/raw/d9c9ebae4f5cf64eed4676e8aedac265b5a51bfa/Install-Docker-on-Linux-Mint.sh | bash -x
##########################################
# Check that HTTPS transport is available to APT
if [ ! -e /usr/lib/apt/methods/https ]; then
sudo apt-get update
sudo apt-get install -y apt-transport-https
fi
@nyxz
nyxz / letsencrypt-wordpress-setup.md
Created March 20, 2018 10:11 — forked from harryfinn/letsencrypt-wordpress-setup.md
Instructions on how to setup a Letsencrypt SSL certificate on a WordPress site

Letsencrypt (for WordPress sites)

Note: This setup assumes you are running Ubuntu 16.04 OS with Apache 2.4.23, older versions of Ubuntu (i.e. 14.04) require minor configuration changes in order for this setup to work.

Setup

Follow the install instructions for certbot (letsencrypt's SSL manager) on https://certbot.eff.org/, making sure to select the correct server OS version.

Note: You only need to complete the Install section, then return to this README in order to setup your SSL

Sometimes I need to copy some text file into the DB as bytea or get bytea from the DB as text file.

For the examles I'll use the Firebase credentials file (in JSON format).

Table

CREATE TABLE system_properties (