Skip to content

Instantly share code, notes, and snippets.

View Grauwolf's full-sized avatar

Farhad Shahbazi Grauwolf

View GitHub Profile
@ahmetb
ahmetb / gcrgc.sh
Last active February 26, 2024 09:14
Script to clean up Google Container Registry images pushed before a particular date
#!/bin/bash
# Copyright © 2017 Google Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@4poc
4poc / bintest.js
Created October 11, 2016 09:33
Buffer Schema Type in Mongoose: How to specify subtype
'use strict';
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const ObjectId = Schema.Types.ObjectId;
const MongooseBuffer = mongoose.Types.Buffer;
const uuid = require('node-uuid');
const db = require('../lib/database');
@conspect
conspect / cult_of_ignorance.md
Last active January 22, 2024 10:33
A Cult Of Ignorance, Isaac Asimov

It's hard to quarrel with that ancient justification of the free press: "America's right to know." It seems almost cruel to ask, ingeniously, "America's right to know what, please? Science? Mathematics? Economics? Foreign languages?"

None of those things, of course. In fact, one might well suppose that the popular feeling is that Americans are a lot better off without any of that tripe.

There is a cult of ignorance in the United States, and there always has been. The strain of anti-intellectualism has been a constant thread winding its way throughout political and cultural life, nurtured by the false notion that democracy means that "my ignorance is just as good as your knowledge."

Politicians have routinely striven to speak the language of Shakespeare and Milton as ungrammaticaly as possible in order to avoid offending their audiences by appearing to have gone to school. Thus, Adlai Stevenson, who incautiously allowed intelligence and learning and wit to peep out of his speeches, found the American people

@EvilGrinUK
EvilGrinUK / lvm_backup.sh
Last active August 13, 2019 08:33
LVM Snapshot Backup - Takes a snapshot of each logical volume in a volume group and creates a compressed dd copy in a specific directory.
#!/bin/bash
VG_NAME="vg0"
SNAPSHOT_SIZE="+2G"
BACKUP_LOCATION="/backups"
DAYSTOKEEP=7
for lv in $(lvs --noheadings --nosuffix --aligned --separator , -o lv_name,lv_attr | grep -v ,s | cut -d, -f1)
do
LV_SIZE="$(lvs --units m --noheadings --nosuffix --aligned --separator , -o lv_name,lv_size | grep "$lv" | cut -d',' -f2 | cut -d. -f 1)" # LV size in MB
@azet
azet / get_alexa_1m_mx_rrs
Last active September 6, 2017 08:55
Retrieves MX and A records for 'Alexa Top 1 Million' hosts and prints them as pretty formatted JSON objects to stdout.
#!/usr/bin/env bash
#
# Retrieves MX and A records for 'Alexa Top 1 Million' hosts
# and prints them as pretty formatted JSON objects to stdout.
#
# *Optional* parallelism support with GNU Parallel (recommended):
# $ sudo apt-get install parallel
#
# Authors: Aaron Zauner <azet@azet.org>
# License: CC0 1.0 (https://creativecommons.org/publicdomain/zero/1.0)
@drkarl
drkarl / gist:739a864b3275e901d317
Last active October 17, 2023 10:43
Ask HN: Best Linux server backup system?

Linux Backup Solutions

I've been looking for the best Linux backup system, and also reading lots of HN comments.

Instead of putting pros and cons of every backup system I'll just list some deal-breakers which would disqualify them.

Also I would like that you, the HN community, would add more deal breakers for these or other backup systems if you know some more and at the same time, if you have data to disprove some of the deal-breakers listed here (benchmarks, info about something being true for older releases but is fixed on newer releases), please share it so that I can edit this list accordingly.

  • It has a lot of management overhead and that's a problem if you don't have time for a full time backup administrator.
@4poc
4poc / gist:5d90091db803f52b618d
Last active August 29, 2015 14:03
GO IRC Bot
package main
import (
"bufio"
"crypto/tls"
"fmt"
"io"
"net"
"reflect"
"regexp"
@4poc
4poc / gist:c279d24157af06d12cbe
Last active June 23, 2022 09:53
GOZORK Text Adventure Game
/**
* GOZORK Text Adventure Game
* by apoc <http://apoc.cc>
*
* Inspired by the infamous beginning of Zork I.
* Reading the source will obviously spoil the game.
* The goal is to somehow kill the troll.
* Oh yeah and: This is my first GO program! Which would be
* my perfect excuse for the bad code quality1!
* Here is a solution/transcript:
@ruario
ruario / README.md
Last active May 20, 2021 17:02
This script provides a method for creating generic (cross-distro), installable, binary packages. The created packages include a log that makes uninstall easy.

Createpkg

Intro

This script provides a simple method for tracking software that you have built from source, or binaries that you want to repackage from another distribution. It also simplifies transferring the software to other machines for install or backup. It works as a nice secondary package management tool, without the need to work with complex, distro specific, build tools.

# This gist is compatible with Ansible 1.x .
# For Ansible 2.x , please check out:
# - https://gist.github.com/dmsimard/cd706de198c85a8255f6
# - https://github.com/n0ts/ansible-human_log
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#