Skip to content

Instantly share code, notes, and snippets.

@kparms
kparms / config.php
Created March 10, 2017 18:11 — forked from anonymous/config.php
Config.php
<?php
DEFINE("DB_HOST","localhost");
DEFINE("DB_USER","ricky");
DEFINE("DB_PASS","is_a_douche");
DEFINE("DB_NAME","rekt");
?>
@kparms
kparms / form.html
Last active February 23, 2017 21:44
3 input boxes
<html>
<body>
<form action="page.php">
<table>
<tr>
<td><input type="text" name="name"></td>
</tr>
<tr>
<td><input type="text" name="email"></td>
</tr>
@kparms
kparms / getQS.js
Created January 25, 2017 15:20
Get Querystring values from URL using Javascript
/* KP: Read in querystring values and perform filtering */
var path = window.location.href;
$scope.searchTerms = path.indexOf('?') > 0 ? path.split('?')[1].split('&') : [];
if ($scope.searchTerms.length > 0) {
for (i = 0; i < $scope.searchTerms.length; i++) {
var searchTerm = $scope.searchTerms[i].split('=');
var name = searchTerm[0];
var value = searchTerm[1];
}
adduser --system shareuser
chown -R shareuser /path/to/share
Then add force user and permission mask settings in smb.conf:
[myshare]
path = /path/to/share
writeable = yes
browseable = yes
public = yes
create mask = 0644
@kparms
kparms / SP2013.js
Last active June 14, 2016 17:37
Update List Items in SharePoint 2013 REST
function updateJson(endpointUri,payload, success, error)
{
$.ajax({
url: endpointUri,
type: "POST",
data: JSON.stringify(payload),
contentType: "application/json;odata=verbose",
headers: {
"Accept": "application/json;odata=verbose",
"X-RequestDigest" : $("#__REQUESTDIGEST").val(),
@kparms
kparms / deduplicate.js
Created June 3, 2016 13:02
Deduplicate Associated Array in JS
var parsedData = [];
/*KP: In parsedData we have a key called PsId */
/* KP: Deduplicate */
parsedData.forEach(function(value, key) {
var seen = [];
for (i=0; i < value.length; i++){
if (seen[value[i].PsId]) {
value.splice(i,1);
i--; }
@kparms
kparms / amazon-s3-ls.txt
Created May 25, 2016 13:18
Using LS command against amazon s3
http://docs.aws.amazon.com/cli/latest/reference/s3/ls.html
Documentation for aws s3 ls
AWS have recently release their Command Line Tools. This works much like boto and can be installed using sudo easy_install awscli or sudo pip install awscli
Once you have installed, you can then simply run
aws s3 ls
Which will show you all of your available buckets
@kparms
kparms / directory-inventory.py
Last active November 18, 2022 01:06 — forked from Grimthorr/directory-inventory.py
Python script to generate a text file listing all files from a given directory (including those in sub-folders).
import os
# start editable vars #
outputfile = "inventory.txt" # file to save the results to
folder = "C:\\Users\\[User]\\Documents" # the folder to inventory
exclude = ['Thumbs.db','.tmp'] # exclude files containing these strings
pathsep = "\\" # path seperator ('/' for linux, '\\' for Windows)
# end editable vars #
with open(outputfile, "w") as txtfile:
@kparms
kparms / description.txt
Created November 19, 2015 17:27
Offline Install of Visual Studio Community 2015 - Download Instructions
Downloading Visual Studio for an offline installation
In most cases, you can install Visual Studio from the download site with no problems. However, in some cases, you may want to download all the update packages before you install them (for example, to install on multiple machines or on an offline machine). The following steps explain how to download all the update packages that you need for an offline installation.
After you download the update executable from the MSDN website to a location on your file system, run the following command at a command prompt: <executable name> /layout.
This command downloads all the packages for the installation.
By using the /layout switch, you can download all the core installation packages, not just the ones that apply to the download machine. This approach gives you all the files that you need to run this update anywhere and may be useful if you want to install components that weren't installed originally.
After you run the command, you should be prompted for the download
@kparms
kparms / FeedFetcher.py
Created November 1, 2015 17:42 — forked from flibbertigibbet/FeedFetcher.py
Checks for new GTFS feeds, then downloads and validates them. Fetches feeds for SEPTA, NYC MTA, NJ TRANSIT, CTTRANSIT, Delaware First State, NJ/NY PATH, and PATCO. Dependencies: Python requests, BeautifulSoup, git, and Google's transit feed validator. NJ TRANSIT developer login credentials required to download from that agency. Cannot check for …
#!/usr/bin/python
import requests, os, pickle, datetime, zipfile, subprocess, csv
from bs4 import BeautifulSoup
class FeedFetcher():
def __init__(self, ddir=os.getcwd(), get_nj=True, nj_username='', nj_pass=''):
self.ddir = ddir
self.get_nj = get_nj # whether to fetch from NJ TRANSIT or not
self.tc = {} # time checks for GTFS fetches