Skip to content

Instantly share code, notes, and snippets.

Aleksandr Krivoshchekov SuperPaintman

Block or report user

Report or block SuperPaintman

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@SuperPaintman
SuperPaintman / result.h
Last active Mar 3, 2018
Rust flavored error handling for C
View result.h
#ifndef RESULT_H_
#define RESULT_H_
// Includes
#include <stdbool.h>
#include <stdint.h>
// Macros
#define RESULT_TEMPLATE(name, typeOk, typeErr) \
typedef struct name { \
View postgresql_fixing_sequences.sh
#!/bin/bash
#
# Author: SuperPaintman <SuperPaintmanDeveloper@gmail.com>
#
database_name="my_awesome_database"
psql -Atq "$database_name" <<SQL | psql -Atq "$database_name"
SELECT 'SELECT ' ||
@SuperPaintman
SuperPaintman / sweet.setd.sjs.js
Last active Oct 12, 2016
Sweet.js - set default
View sweet.setd.sjs.js
syntax setd = (ctx) => {
const dummy = #`dummy`.get(0);
let result = #``;
ctx.expand('expr');
ctx.reset();
const selectors = [];
View abstract-class.js
export class AbstractClass {
constructor(constructor, name) {
if (!name) {
name = constructor.name;
}
if (this.constructor === AbstractClass) {
throw new Error(`Cannot create an instance of the abstract class "AbstractClass"`);
}
@SuperPaintman
SuperPaintman / mongodb_git_backup_export.sh
Last active Sep 13, 2016
Backup a MongoDB database using Git
View mongodb_git_backup_export.sh
#!/bin/bash
#
# Author: SuperPaintman <SuperPaintmanDeveloper@gmail.com>
#
# Export
# Init
me=$(basename "$0")
@SuperPaintman
SuperPaintman / create_default_gl_labels.sh
Created Sep 8, 2016
Create default labels for Gitlab project
View create_default_gl_labels.sh
#!/bin/bash
#
# Author: SuperPaintman <SuperPaintmanDeveloper@gmail.com>
#
# Init
me=$(basename "$0")
RETVAL=0
env_name_token="GITLAB_PRIVATE_TOKEN"
View escape_json.sh
escape_json () {
echo "${1//$'\n'/\\n}" | sed 's/\\/\\\\/g' | sed 's/\\\\n/\\n/g' | sed 's/"/\\"/g' | sed "s/'/\\'/g"
}
View add_swap.sh
#!/bin/bash
if [[ $(swapon -s) != "" && $(swapon -s | wc -l) != 0 ]]; then
echo "Swap already created"
exit 1
fi
SWAP_FILENAME="/swapfile"
mem_size="$(free | grep -i 'mem:' | awk '{ print $2 }')"
View build_love2d.sh
#!/usr/bin/bash
RETVAL=0
if [ -z "$1" ]; then
echo "Usage: build <bin_name>"
exit 1
fi
bin_name="$1"
@SuperPaintman
SuperPaintman / docker-letsencrypt-renew.sh
Last active Sep 13, 2016
Auto renew Let's Encrypt throw Docker
View docker-letsencrypt-renew.sh
#!/bin/bash
#
# Author: SuperPaintman <SuperPaintmanDeveloper@gmail.com>
#
###
# Constants
###
RETVAL=0
You can’t perform that action at this time.