Skip to content

Instantly share code, notes, and snippets.

@vishnuvp
vishnuvp / connectToWifi.sh
Created December 27, 2018 14:35
Connect to wifi in Ubuntu through commandline
nmcli dev wifi connect <ssid> password <password>
@vishnuvp
vishnuvp / IOC Splunker
Created January 16, 2018 05:45 — forked from irctrakz/IOC Splunker
Script to parse openIOC format files and search Splunk for extracted IP addresses.
#! /usr/bin/perl
#
# Script written to pull IP data from openIOC and search Splunk.
#
use strict;
use warnings;
$|=1;
{
"clients": [
{
"id": "59761c23b30d971669fb42ff",
"isActive": true,
"age": 36,
"name": "Dunlap Hubbard",
"gender": "male",
"company": "CEDWARD",
"email": "dunlaphubbard@cedward.com",
{"SecurityGroups": [{ "IpPermissionsEgress": [], "Description": "", "IpPermissions": [{ "PrefixListIds": [], "FromPort": "", "IpRanges": [{ "CidrIp": "" }], "ToPort": "", "IpProtocol": "", "UserIdGroupPairs": []}], "GroupName": "", "OwnerId": "", "GroupId": ""}]}
{"EndpointGroups":[{"name":"Group1","Policies":[{"name":"Policy1","Rules":[{"name":"Rule1","protocol":"tcp","port":"22","direction":"out","ip-address":"0.0.0.0"}]}]}]}
@vishnuvp
vishnuvp / config-check.sh
Created February 7, 2017 05:45
Docker Config Check Script
#!/usr/bin/env bash
set -e
EXITCODE=0
# bits of this were adapted from lxc-checkconfig
# see also https://github.com/lxc/lxc/blob/lxc-1.0.2/src/lxc/lxc-checkconfig.in
possibleConfigs=(
'/proc/config.gz'
@vishnuvp
vishnuvp / config-check.sh
Created February 7, 2017 05:45
Docker Config Check Script
#!/usr/bin/env bash
set -e
EXITCODE=0
# bits of this were adapted from lxc-checkconfig
# see also https://github.com/lxc/lxc/blob/lxc-1.0.2/src/lxc/lxc-checkconfig.in
possibleConfigs=(
'/proc/config.gz'
@vishnuvp
vishnuvp / DockerINSTALL
Last active January 17, 2017 07:13
Docker installation steps on Ubuntu16.04
sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates
# Add new GPG key
sudo apt-key adv \
--keyserver hkp://ha.pool.sks-keyservers.net:80 \
--recv-keys 58118E89F3A912897C070ADBF76221572C52609D
# If the above keyserver is not available, try hkp://pgp.mit.edu:80 or hkp://keyserver.ubuntu.com:80.
@vishnuvp
vishnuvp / crt.py
Created February 11, 2016 06:32
A simple python Chinese Reminder Theorem snippet to solve a system of congruences
def extendedEuclid(a,b):
#print 'extendedEuclid of ',a,b
if b==0:
return (a,1,0)
tuplPrime = extendedEuclid(b,a % b)
return [tuplPrime[0], tuplPrime[2], (tuplPrime[1] - (a//b)*tuplPrime[2])]
/*
For some reason, the change() event only fires when the input field loses focus.
Binding to other options ('change keypress paste focus textInput input') will
fire the event several times, which is bad. The below code works even when
content is pasted into the text field, and only fires once as expected.
*/
$('#search-form .term').bind('input', function(){
console.log('this actually works');
});