Skip to content

Instantly share code, notes, and snippets.

View oz123's full-sized avatar
🎯
Focusing

Oz Tiram oz123

🎯
Focusing
View GitHub Profile
@aziz-blr
aziz-blr / dropzone.js
Created August 1, 2017 08:39
custom events for dropzone including server side rendering & max files upload limit
$(function () {
// Get the template HTML and remove it from the doumenthe template HTML and remove it from the doument
var previewNode = document.querySelector("#referenceTemplate");
previewNode.id = "";
var previewTemplate = previewNode.parentNode.innerHTML;
previewNode.parentNode.removeChild(previewNode);
Dropzone.autoDiscover = false;
var myDropzone = new Dropzone(".uploadReference", {// Make the whole body a dropzone
url: "ajax/upload-file.php", // Set the url
@Thrilleratplay
Thrilleratplay / arch-linux-install.md
Last active November 8, 2024 00:06
Installing Arch Linux on a fully encrypted LUKS partition using GRUB
@eleanxr
eleanxr / gentoo-encryption.md
Last active May 10, 2022 20:53
Gentoo Encrypted Installation Notes

Boot and Drive Partitioning

  • Start with gentoo-nofb to make the window readable on a VM with a lower resolution host.
  • On VM network just works. Will need to deal with wireless on real install.
  • Follow instructions for default partition layout on handbook, use GPT.
  • Switch to dm-crypt instructions for creating fileystems.
    • `# cryptsetup -s 512 luksFormat /dev/sda4
  • cryptsetup is already available on minimal image, no need to emerge it.
  • Use ext2 for boot partition, follow swap instructions in handbook.
@mivade
mivade / cli.py
Last active March 20, 2025 12:56
Using a decorator to simplify subcommand creation with argparse
"""This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
@hemebond
hemebond / 0_article.md
Last active March 13, 2022 11:51
A SaltStack AWS Auto Scaling Solution

A SaltStack AWS Auto Scaling Solution

Overview

The AWS Auto Scaling Goup, configured with a customised Cloud-Init file, sends a notification to an SNS Topic, which in turn passes it onto an SQS queue that the Salt Master is subscribed to. A Reactor watches for the auto scaling events and pre-approves the new minion based on its Auto Scaling group name and instance ID.

Salt Master Configuration

@nicoddemus
nicoddemus / test_server.py
Created July 7, 2016 20:08
FTPServer fixture example
import re
from pyftpdlib.authorizers import DummyAuthorizer
from pyftpdlib.handlers import FTPHandler
from pyftpdlib.servers import FTPServer
import pytest
@pytest.yield_fixture
def ftp_server(tmpdir, request):
authorizer = DummyAuthorizer()
@stewartpark
stewartpark / slack_coverage.py
Last active August 7, 2017 12:33
Automated test coverage report. (Jenkins<3Slack)
"""
Slack coverage.py notifier.
Stewart Park <[email protected]>
It reports test coverage to a Slack channel as a Jenkins bot.
Add this as a post-build/build step once coverage.py generates the html report.
Once everything is properly set up, you can add a badge on your README like below:
[![Coverage.py](http://<jenkins-host>/job/<job-name>/coveragepy/badge.svg)](http://<jenkins-host>/job/<job-name>/coveragepy/)
@gtallen1187
gtallen1187 / slope_vs_starting.md
Created November 2, 2015 00:02
A little bit of slope makes up for a lot of y-intercept

"A little bit of slope makes up for a lot of y-intercept"

01/13/2012. From a lecture by Professor John Ousterhout at Stanford, class CS140

Here's today's thought for the weekend. A little bit of slope makes up for a lot of Y-intercept.

[Laughter]

@thedemz
thedemz / sessiontest.py
Last active January 13, 2018 19:16 — forked from alexcabrera/sessiontest.py
Example of using beaker sessions with bottle
import bottle
from beaker.middleware import SessionMiddleware
session_opts = {
'session.type': 'memory',
'session.cookie_expires': 300,
'session.auto': True
}
app = SessionMiddleware(bottle.app(), session_opts)