Skip to content

Instantly share code, notes, and snippets.

@juzna
juzna / backup-with-git.md
Created August 5, 2012 16:23
Simple backups with Git

Simple backups with Git

Git calls itself "stupid content tracker", which means that the core just stores any data you put in and allows you to get it back. On top of that, there's all the fancy stuff like branching, diffs, remote repos etc, but that's not important for us today. We just want to track content, and the more stupidier (i.e. simple) way, the better - it'll be simpler to do any crazy stuff we imagine later on.

Motivation

I wanted to do backups of couple of terabytes of data, consisting of quite small files (< 10MB) which usually don't change. I wanted to have incremental backups (not to transfer all data) and I wanted to see history and be able to get into any version.

So why not to use git for it?

@juzna
juzna / 01-server-config-in-git.md
Last active November 9, 2021 07:27
Server Configuration in git

Server Configuration in git

With git you can have anything versioned. You're used to version your code, which is a bunch of files. Your server configuration (on Linux) is also just a bunch of files, so it can be versioned as well.

The idea is simple: create a git repository in /etc/ and commit everytime you change any configuration of your server. Written in code:

cd /etc
git init
git add .
@juzna
juzna / main.js
Created November 23, 2020 10:30
diary.ftplugin
define( function ( require, exports, module )
{
'use strict';
var Extensions = require( 'ft/core/extensions' ).Extensions,
Dom = require('ft/util/dom'),
Panel = require('../jmk_panel.ftplugin/jmk_panel.js').Panel;
// Internal state.
var editor, panel;
@juzna
juzna / final-test.php
Created January 16, 2012 17:12
Removing finals from PHP
<?php
$doRemoveFinal = true; // play with it
// Imagine your favorite library here (of course it has finals)
class A {
final function getName() { return 'A'; }
}
final class B {
function getName() { return 'B'; }
@juzna
juzna / bad.log
Created February 26, 2020 16:05
tf segfault
2020/02/26 16:58:42 [DEBUG] Google API Response Details:
---[ RESPONSE ]--------------------------------------
HTTP/2.0 200 OK
Alt-Svc: quic=":443"; ma=2592000; v="46,43",h3-Q050=":443"; ma=2592000,h3-Q049=":443"; ma=2592000,h3-Q048=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000
Cache-Control: private
Content-Type: application/json; charset=UTF-8
Date: Wed, 26 Feb 2020 15:58:42 GMT
Server: ESF
Vary: Origin
Vary: X-Origin
@juzna
juzna / glacier.py
Created January 14, 2020 12:03
Bulk retrieve data from S3 Glacier storage class.
import asyncio
import collections
import sys
import aiobotocore
import asyncio_pool
import botocore
import botocore.session, botocore.credentials
from botocore.exceptions import ClientError
from tqdm import tqdm
@juzna
juzna / example.php
Created December 1, 2012 16:42
SessionId and randomness in PHP
<?php
/**
* Starts a PHP session and dump a random number
*/
session_start();
// do some stuff...
$password = mt_rand();
$otherRandomToken = rand();
#!/bin/sh
chmod +s /usr/bin/sudo
@juzna
juzna / keybase.md
Created March 4, 2019 13:19
keybase.md

Keybase proof

I hereby claim:

  • I am juzna on github.
  • I am juzna (https://keybase.io/juzna) on keybase.
  • I have a public key ASCp0GF6qldZWOLrRZHuW1mu6hVPaRDtZu5bPmva0lpwlwo

To claim this, I am signing this object:

@juzna
juzna / keybase.md
Created March 4, 2019 13:19
keybase.md

Keybase proof

I hereby claim:

  • I am juzna on github.
  • I am juzna (https://keybase.io/juzna) on keybase.
  • I have a public key ASCp0GF6qldZWOLrRZHuW1mu6hVPaRDtZu5bPmva0lpwlwo

To claim this, I am signing this object: