Skip to content

Instantly share code, notes, and snippets.

Martin Vancl tuxmartin

Block or report user

Report or block tuxmartin

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
@tnhu
tnhu / excel_generator.py
Created Apr 22, 2016
Open and Edit an Excel template using Python's openpyxl library
View excel_generator.py
from openpyxl import load_workbook
wb = load_workbook('template.xlsx')
# grab the active worksheet
ws = wb.active
# Data can be assigned directly to cells
ws['A2'] = 'Tom'
ws['B2'] = 30
@Manouchehri
Manouchehri / windows10qemu.sh
Last active Jul 31, 2019
Running Windows 10 in a UEFI enabled QEMU environment with KVM.
View windows10qemu.sh
# Installing
qemu-system-x86_64 -bios /usr/share/ovmf/ovmf_x64.bin -enable-kvm -cpu host -smp 4 -m 2048 -cdrom ~/Downloads/Win10_English_x64.iso -net nic,model=virtio -net user -drive file=~/vm/win10.hd.img.raw,format=raw,if=virtio -vga qxl -drive file=~/Downloads/virtio-win-0.1.105.iso,index=1,media=cdrom
# Running
qemu-system-x86_64 -bios /usr/share/ovmf/ovmf_x64.bin -enable-kvm -cpu host -smp 4 -m 4096 -net nic,model=virtio -net user -drive file=~/vm/win10.hd.img.raw,format=raw,if=virtio -vga qxl -usbdevice tablet -rtc base=utc
@danilop
danilop / gist:d4ff43835e469043e95e
Last active Sep 27, 2018
Amazon S3 redirection rule to send every "miss" (HTTP 404) to the domain root
View gist:d4ff43835e469043e95e
<RoutingRules>
<RoutingRule>
<Condition>
<HttpErrorCodeReturnedEquals>404</HttpErrorCodeReturnedEquals>
</Condition>
<Redirect>
<HostName>danilop.net</HostName>
<ReplaceKeyWith/>
</Redirect>
</RoutingRule>
@jeffcrouse
jeffcrouse / poco_http_post_headers.cpp
Last active Oct 7, 2019
Poco HTTPPOST request with headers
View poco_http_post_headers.cpp
#include <Poco/Net/HTTPClientSession.h>
#include <Poco/Net/HTTPRequest.h>
#include <Poco/Net/HTTPResponse.h>
#include <Poco/StreamCopier.h>
#include <Poco/Path.h>
#include <Poco/URI.h>
#include <Poco/Exception.h>
using namespace Poco::Net;
using namespace Poco;
@nickretallack
nickretallack / joins.py
Last active Jan 28, 2019
How do I do a join without a real foreign key constraint?
View joins.py
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, ForeignKey, Integer, String, ForeignKeyConstraint
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker, relationship
Model = declarative_base()
class Parent(Model):
__tablename__ = 'parent'
id = Column(Integer, primary_key=True)
@raramuridesign
raramuridesign / wp-sql-replace-url
Created Oct 29, 2014
Wordpress replace old url with new url [mysql search and replace]
View wp-sql-replace-url
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://www.oldurl','http://www.newurl');
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldurl', 'http://www.newurl');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.oldurl','http://www.newurl');
@alice-xu
alice-xu / openvpn_stats.sh
Last active Jun 10, 2017
OpenVPN monitoring script for Zabbix
View openvpn_stats.sh
#!/usr/bin/env bash
#
# openvpn_stats.sh:
# OpenVPN monitoring script for Zabbix
#
# $1: OpenVPN server host IP/hostname. (default: 127.0.0.1)
# $2: OpenVPN management CLI port. (default: 7505)
# $3: Password file for OpenVPN management CLI. (default: <none>)
# $4: Timeout(sec) (default: 3)
#
@jbinto
jbinto / howto-recover-google-authenticator-keys.txt
Created Feb 8, 2014
Recovering Google Authenticator keys from Android device for backup
View howto-recover-google-authenticator-keys.txt
### Last tested February 7 2014 on a Galaxy S3 (d2att) running Cyanogenmod 11 nightly, with Google Authenticator 2.49.
### Device with Google Authenticator must have root.
### Computer requires Android Developer Tools and SQLite 3.
### Connect your device in USB debugging mode.
$ cd /tmp
$ adb root
$ adb pull /data/data/com.google.android.apps.authenticator2/databases/databases
@robulouski
robulouski / gmail_imap_example.py
Last active Oct 11, 2019
Very basic example of using Python and IMAP to iterate over emails in a gmail folder/label. http://www.voidynullness.net/blog/2013/07/25/gmail-email-with-python-via-imap/
View gmail_imap_example.py
#!/usr/bin/env python
#
# Very basic example of using Python and IMAP to iterate over emails in a
# gmail folder/label. This code is released into the public domain.
#
# RKI July 2013
# http://www.voidynullness.net/blog/2013/07/25/gmail-email-with-python-via-imap/
#
import sys
import imaplib
@plentz
plentz / nginx.conf
Last active Oct 18, 2019
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
View nginx.conf
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
You can’t perform that action at this time.