Skip to content

Instantly share code, notes, and snippets.

View danitfk's full-sized avatar

danitfk danitfk

View GitHub Profile
@sirbrillig
sirbrillig / pgsql_backup.sh
Last active July 23, 2024 11:54 — forked from dangerousbeans/pgsql_backup.sh
Postgresql daily backup script.
#!/bin/bash
#
# Backup a Postgresql database into a daily file.
#
BACKUP_DIR=/pg_backup
DAYS_TO_KEEP=14
FILE_SUFFIX=_pg_backup.sql
DATABASE=
USER=postgres
@ssstonebraker
ssstonebraker / sed cheatsheet
Created August 2, 2013 14:06 — forked from un33k/sed cheatsheet
Sed Cheatsheet
FILE SPACING:
# double space a file
sed G
# double space a file which already has blank lines in it. Output file
# should contain no more than one blank line between lines of text.
sed '/^$/d;G'
@dlanileonardo
dlanileonardo / .bashrc
Last active December 12, 2018 16:01
Pretty Bash
#######################
# Pretty .bashrc
#######################
alias mountedinfo='df -hT'
BLACK='\e[0;30m'
BLUE='\e[0;34m'
GREEN='\e[0;32m'
CYAN='\e[0;36m'
@bftanase
bftanase / secure_link.php
Last active July 19, 2024 16:14
generate URL for nginx secure_link
@goldyfruit
goldyfruit / pkg.yml
Last active December 16, 2020 09:40
[ansible] Check via the yum module and a registered value if a package is installed or not
---
- name: Ansible tests playbook
hosts: all
remote_user: root
tasks:
- name: Check if mariadb-libs-5.5.44-2.el7.centos.x86_64 package is installed
yum:
list=mariadb-libs-5.5*x86_64
register: pkg
@mostafasoufi
mostafasoufi / query.sql
Last active January 11, 2023 14:17
Change wordpress URLs with Mysql query
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://www.oldurl','http://www.newurl');
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldurl', 'http://www.newurl');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.oldurl','http://www.newurl');
@andromedarabbit
andromedarabbit / elastalert-rule.yaml
Created March 3, 2017 15:44
ElastAlert rule example
# Alert when the rate of events exceeds a threshold
# (Required)
# Rule name, must be unique
name: OutOfMemoryError
# (Required)
# Type of alert.
# the frequency rule type alerts when num_events events occur with timeframe time
type: frequency
@dragolabs
dragolabs / proxmox-cli-and-tips.md
Last active January 4, 2024 10:21
Useful proxmox commands

Find next free VM ID

pvesh get /cluster/nextid

Create containter with external and internal nets

pct create 100 \
    local:vztmpl/ubuntu-16.04-standard_16.04-1_amd64.tar.gz \
    --cores 2 --cpuunits 1024 \
anonymous
anonymous / Peugeot 207 Rc Service Manual.md
Created July 16, 2017 03:31
Peugeot 207 Rc Service Manual

Peugeot 207 Rc Service Manual==============================>>> DOWNLOAD <<<==============================Peugeot 207 Rc Service ManualPeugeot 207 Rc Service Manual from facebook. Include snow thrower lubrication, to our friendly sales. You have read and agree to the Global Shipping Program terms and conditions - opens in and done quickly using high-quality, brand name parts. Maintenance: Carbody warranty: 12 years. Peugeot 207 Rc Service Manual dropbox upload. 207 CC 150

@posener
posener / go-shebang-story.md
Last active July 26, 2024 01:16
Story: Writing Scripts with Go

Story: Writing Scripts with Go

This is a story about how I tried to use Go for scripting. In this story, I’ll discuss the need for a Go script, how we would expect it to behave and the possible implementations; During the discussion I’ll deep dive to scripts, shells, and shebangs. Finally, we’ll discuss solutions that will make Go scripts work.

Why Go is good for scripting?

While python and bash are popular scripting languages, C, C++ and Java are not used for scripts at all, and some languages are somewhere in between.