- Using a ready-to-use Ubuntu image
Taken from a DigitalOcean tutorial.
Create and enable swapfile:
# create a 2GB file only accessible by root
sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
# mark the file as a swap space
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT table, | |
formatReadableSize(sum(bytes)) as size, | |
min(min_date) as min_date, | |
max(max_date) as max_date | |
FROM system.parts | |
WHERE active | |
GROUP BY table |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
char *user_country_name = ""; // [MOD] | |
module_param_named(cn, user_country_name, charp, S_IRUGO); // [MOD] | |
MODULE_PARM_DESC(cn, "Country Name"); // [MOD] | |
static int __ath_regd_init(struct ath_regulatory *reg) | |
{ | |
struct country_code_to_enum_rd *country = NULL; | |
u16 regdmn; | |
if (!reg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
deploy:live: | |
image: 1drop/docker:git | |
stage: deploy | |
when: manual | |
environment: | |
name: production | |
url: https://www.somecustomer.de | |
before_script: | |
- eval $(ssh-agent -s) | |
- ssh-add <(echo "$SSH_PRIVATE_KEY") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#http://www.oidview.com/mibs/0/IF-MIB.html | |
#http://www.net-snmp.org/docs/mibs/interfaces.html | |
cisco_custom: | |
version: 2 | |
auth: | |
community: public | |
walk: | |
- 1.3.6.1.2.1.2.2.1 | |
- 1.3.6.1.2.1.31.1.1.1 | |
metrics: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyModel(models.Model): | |
onefield = models.CharField('The field', max_length=100) | |
class MyModelAdmin(admin.ModelAdmin): | |
def has_add_permission(self, request): | |
# if there's already an entry, do not allow adding | |
count = MyModel.objects.all().count() | |
if count == 0: | |
return True | |
return False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
readonly DB_FILE="$(pwd)/images.db" | |
readonly IMG_DIR="$(pwd)/images" | |
save-images() { | |
echo "Create ${DB_FILE}" | |
echo "$(docker images|grep -v 'IMAGE ID'|awk '{printf("%s %s %s\n", $1, $2, $3)}'|column -t)" > "${DB_FILE}" | |
echo "Read ${DB_FILE}" |
http://mojodna.net/2014/05/14/kvm-libvirt-and-ubuntu-14-04.html
- Get a qcow2 image from here: https://cloud-images.ubuntu.com/releases/16.04/release/
- Convert it with qemu-img
- Resize it (we'll add 50GB). This will be a "thin" resize.
Example: https://cloud-images.ubuntu.com/releases/16.04/release/ubuntu-16.04-server-cloudimg-amd64-disk1.img
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import threading | |
class BaseThread(threading.Thread): | |
def __init__(self, callback=None, callback_args=None, *args, **kwargs): | |
target = kwargs.pop('target') | |
super(BaseThread, self).__init__(target=self.target_with_callback, *args, **kwargs) | |
self.callback = callback | |
self.method = target |
NewerOlder