Skip to content

Instantly share code, notes, and snippets.

View demaniak's full-sized avatar

demaniak

  • @Advance.io
  • PTA, South Africa
View GitHub Profile
@EnigmaCurry
EnigmaCurry / Calibre_remove_empty_books.sh
Created December 5, 2010 00:55
Remove empty books from calibre (books that have no formats available)
calibredb list -f title,author_sort,formats | grep ".*\[\]\W*$" | cut -d " " -f 1 | xargs -iXX calibredb remove XX
@itzg
itzg / ApiController.java
Last active July 10, 2018 13:28
Bare bones unit test of RestController methods in a Spring Boot application.
package com.example;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Map;
@RestController
@RequestMapping("/api")
@bgromov
bgromov / git-reset-author.sh
Created June 23, 2016 17:50
Git: reset author for ALL commits
#!/bin/sh
# Credits: http://stackoverflow.com/a/750191
git filter-branch -f --env-filter "
GIT_AUTHOR_NAME='Newname'
GIT_AUTHOR_EMAIL='new@email'
GIT_COMMITTER_NAME='Newname'
GIT_COMMITTER_EMAIL='new@email'
" HEAD
@wojteklu
wojteklu / clean_code.md
Last active November 16, 2024 22:03
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@smola
smola / GLUSTER_SETUP.sh
Created October 18, 2018 09:24
Quick and dirty single-node GlusterFS setup
#
# Instructions for quick gluster server (1 node) setup with a volume on LVM.
# No replication, just using localhost.
#
# See https://docs.gluster.org/en/latest/Administrator%20Guide/Brick%20Naming%20Conventions/
#
# Install GlusterFS
add-apt-repository ppa:gluster/glusterfs-4.0
apt-get install glusterfs-server
#!/bin/bash
export __NV_PRIME_RENDER_OFFLOAD=1
export __GLX_VENDOR_LIBRARY_NAME=nvidia
export __VK_LAYER_NV_optimus=NVIDIA_only
export VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json
exec "$@"
@kobus-v-schoor
kobus-v-schoor / viz.py
Last active July 12, 2020 18:42
Entelect Challenge 2020 Visualizer
#! /usr/bin/env python3
import os
import sys
import enum
import json
import time
## settings ##
@Ottovsky
Ottovsky / Dockerfile
Created May 11, 2020 14:07
gitlab-runner docker image for armv7
FROM golang:1.13.9-alpine3.11 as build
ARG GIT_LFS_VERSION
RUN mkdir -p src/github.com/git-lfs/git-lfs && \
wget -nv -O /tmp/git-lfs.tar.gz https://github.com/git-lfs/git-lfs/archive/v${GIT_LFS_VERSION}.tar.gz && \
tar xf /tmp/git-lfs.tar.gz -C src/github.com/git-lfs/git-lfs --strip-components 1 && \
GOARCH=arm GOOS=linux GOARM_VERSION=7 CGO_ENABLED=0 go build -a -ldflags '-extldflags "-static"' -o bin/git-lfs github.com/git-lfs/git-lfs/
@christr
christr / update-dns.sh
Last active May 26, 2024 04:00 — forked from mhussain/update-dns.sh
Linode dynamic DNS updating script
#!/bin/bash
# Modified by Chris Richardson (https://github.com/christr and https://twitter.com/christr77) on 09/20/2020
# Previous versions of this script don't work because they hadn't been updated since 2012. There are now more steps involved to set this up.
# This script update is based on information found here: https://developers.linode.com/api/v4/domains-domain-id-records-record-id/#put
# You first must find out the domain ID and resource ID numbers. In order to do this follow the steps below.
# 1. Create a Linode API Key through your account profile at https://cloud.linode.com/dashboard. Give it rights to read/write to domains only.
# 2. From a shell run the following command: LINODE_API_KEY=[insert API key from step 1 here]
# 3. Run the following command to get the domain ID number for the domain you want to manage: curl -H "Authorization: Bearer $LINODE_API_KEY" https://api.linode.com/v4/domains/