This file contains hidden or 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/sh | |
| # | |
| # Shell script for installation and setup of L2TP/IPsec VPN tunnel in site-to-site | |
| # mode (e.g. connecting two inter-regional VPCs). VPN software is libreswan. | |
| # | |
| # This should work on linux systems that are RHEL based. | |
| # | |
| # To install directly from this gist, you can curl the "raw" version and pipe that to | |
| # "bash -s" while also defining the environment variables: | |
| # |
This file contains hidden or 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
| """ | |
| Ported from Paper.js - The Swiss Army Knife of Vector Graphics Scripting. | |
| http://paperjs.org/ | |
| Copyright (c) 2011 - 2014, Juerg Lehni & Jonathan Puckey | |
| http://scratchdisk.com/ & http://jonathanpuckey.com/ | |
| Distributed under the MIT license. See LICENSE file for details. | |
| All rights reserved. |
This file contains hidden or 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
| from __future__ import print_function | |
| import socket | |
| import sys | |
| _module = sys.modules[__name__] | |
| def disable_socket(): | |
| """ disable socket.socket to disable the Internet. useful in testing. | |
| .. doctest:: |
This file contains hidden or 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
| # -*- coding: utf-8 -*- | |
| import store | |
| from tools.tor import ThreadRequestContext | |
| class BaseHandler(RequestHandler): | |
| def prepare(self): | |
| store.db() |
This file contains hidden or 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
| # This is just a cheat sheet: | |
| # On production | |
| sudo -u postgres pg_dump database | gzip -9 > database.sql.gz | |
| # On local | |
| scp -C production:~/database.sql.gz | |
| dropdb database && createdb database | |
| gunzip < database.sql.gz | psql database |
This file contains hidden or 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 | |
| sudo add-apt-repository ppa:chris-lea/libsodium; | |
| sudo echo "deb http://ppa.launchpad.net/chris-lea/libsodium/ubuntu trusty main" >> /etc/apt/sources.list; | |
| sudo echo "deb-src http://ppa.launchpad.net/chris-lea/libsodium/ubuntu trusty main" >> /etc/apt/sources.list; | |
| sudo apt-get update && sudo apt-get install libsodium-dev; |
This file contains hidden or 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
| # aecho.py | |
| from socket import * | |
| import asyncio | |
| loop = asyncio.get_event_loop() | |
| async def echo_server(address): | |
| sock = socket(AF_INET, SOCK_STREAM) | |
| sock.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1) |
This file contains hidden or 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
| #!/usr/bin/env python | |
| from socket import socket, AF_INET, SOCK_DGRAM, timeout | |
| import hashlib | |
| import time | |
| import struct | |
| from scapy.all import sendp, Ether, IPv6, UDP, Raw | |
| from bitarray import bitarray | |
| IP6 = PUT_TARGET_LINK_LOCAL_IPV6_HERE |
This file contains hidden or 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
| from sqlalchemy import create_engine, MetaData, Table | |
| from sqlalchemy.orm import sessionmaker | |
| from sqlalchemy.ext.declarative import declarative_base | |
| from multiprocessing.util import register_after_fork | |
| Base = declarative_base() | |
This file contains hidden or 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
| public class ExcelOperations | |
| { | |
| public List<List<string>> Read(string filePath) | |
| { | |
| OleDbConnection conn = new OleDbConnection("Provider = Microsoft.ACE.OLEDB.12.0; Data Source = " + filePath + "; Extended Properties = 'Excel 8.0; HDR=NO'"); | |
| OleDbCommand cmd = new OleDbCommand("select * from [Sheet1$]", conn); | |
| conn.Open(); | |
| OleDbDataReader dr = cmd.ExecuteReader(); |