Skip to content

Instantly share code, notes, and snippets.

View jpascal's full-sized avatar

Evgeniy Shurmin jpascal

View GitHub Profile
@perfecto25
perfecto25 / restic_cron.sh
Created February 28, 2019 23:20
Restic cron script
#!/bin/bash
# Runs Restic backup on a schedule via cron, emails with status
# 1. add a cred file with your repo logins to /etc/restic/cred
# 2.
FROM="restic@$(hostname)"
EMAIL="user@company.com"
LOG="/var/log/restic.log"
RDIR="/etc/restic"
@poy
poy / subcommands.go
Last active February 27, 2023 06:02
Simple Subcommands in Go
package subcommands
import (
"fmt"
"log"
"os"
"strings"
)
type Command interface {
@preshing
preshing / sort1mb.cpp
Created October 25, 2012 11:28
Sort one million 8-digit numbers in 1MB RAM
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
typedef unsigned int u32;
typedef unsigned long long u64;
//-------------------------------------------------------------------------
// WorkArea
//-------------------------------------------------------------------------
@ta
ta / unicornctl
Created September 9, 2011 18:46
unicornctl manages your app's unicorn server in an easy manner
#!/usr/bin/env ruby
require "getoptlong"
module UnicornCTL
class Controller
def initialize(args, argv)
@args = args
@argv = argv
end
@wbailey
wbailey / databases.rake
Created February 11, 2011 08:58
ActiveRecord migrations outside of Rails
require 'yaml'
require 'logger'
require 'active_record'
namespace :db do
def create_database config
options = {:charset => 'utf8', :collation => 'utf8_unicode_ci'}
create_db = lambda do |config|
ActiveRecord::Base.establish_connection config.merge('database' => nil)
@jpinnix
jpinnix / gist:547977
Created August 24, 2010 17:55
Help nginx+passenger serve static index pages
# Help nginx+passenger serve static index pages
# Site specific config
server {
listen 80;
server_name domain.com;
index index.html;
access_log logs/appname.access.log;
error_log logs/appname.error.log;