2016-11-05 VimConf 2016
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
# Constructed with help from | |
# http://stackoverflow.com/questions/53497/regular-expression-that-matches-valid-ipv6-addresses | |
# Try it on regex101: https://regex101.com/r/yVdrJQ/1 | |
import re | |
IPV4SEG = r'(?:25[0-5]|(?:2[0-4]|1{0,1}[0-9]){0,1}[0-9])' | |
IPV4ADDR = r'(?:(?:' + IPV4SEG + r'\.){3,3}' + IPV4SEG + r')' | |
IPV6SEG = r'(?:(?:[0-9a-fA-F]){1,4})' | |
IPV6GROUPS = ( |
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
ISC License | |
Copyright (c) 2016, Job Vranish | |
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. | |
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
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
//DNS Query Program on Linux | |
//Author : Silver Moon ([email protected]) | |
//Dated : 29/4/2009 | |
//Header Files | |
#include<stdio.h> //printf | |
#include<string.h> //strlen | |
#include<stdlib.h> //malloc | |
#include<sys/socket.h> //you know what this is for | |
#include<arpa/inet.h> //inet_addr , inet_ntoa , ntohs etc |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import os | |
import re | |
import time | |
import json | |
import logging | |
import requests |
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
#include "functional" | |
#include "iostream" | |
namespace proj | |
{ | |
/// Polymorphism in C++ is typically implemented with dynamic dispatch. On the plus side, it's | |
/// easy to grasp (initially), well-understood, and works retroactively. On the minus side, it | |
/// sucks you into OOP quagmires too easily and is not terribly efficient. Knowing about other | |
/// types of polymorphims may lead you to avoid this approach wherever practical. Places where | |
/// it's practically unavoidable are those that require user-defined subtypes, such as plugins |
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
function! ShowOnGithub() | |
let u = system("echo ${${${$(git --git-dir=.git config --get remote.origin.url)#[email protected]:}%.git}#https://github.com/} | xargs echo -n") | |
silent exec "!open "."https://github.com/".u."/blob/master/".@%.'\#L'.line(".") | |
endfunction | |
command! -nargs=0 ShowOnGithub call ShowOnGithub() | |
nnoremap <Leader>gh :ShowOnGithub<CR> |
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
#include <stdio.h> | |
#include <string.h> | |
extern void hexdump(FILE * stream, void const * data, unsigned int len) | |
{ | |
unsigned int i; | |
unsigned int r,c; | |
if (!stream) | |
return; |
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
/* | |
Create server/client self-signed certificate/key (self signed, DONT ADD PASSWORD) | |
openssl req -x509 -newkey rsa:2048 -days 3650 -nodes -keyout client-key.pem -out client-cert.pem | |
openssl req -x509 -newkey rsa:2048 -days 3650 -nodes -keyout server-key.pem -out server-cert.pem | |
*/ | |
#include <stdio.h> |
NewerOlder