Skip to content

Instantly share code, notes, and snippets.

View lanekatris's full-sized avatar

Lane Katris lanekatris

View GitHub Profile
# Secure copy
scp ~/my_local_file.txt user@remote_host.com:/some/remote/directory
scp user@remote_host.com:/some/remote/directory ~/my_local_file.txt
while ($true) {
$result = curl http://localhost:3000
if ($result -eq $null) {
write-host "null!"
}
if ($result.StatusCode -eq 200) {
Write-Host "Success" . $result.StatusCode
@lanekatris
lanekatris / download-certs-proprofs.js
Last active November 23, 2017 15:32
ES6 javascript to download certificates from proprofs.com via webscraping. Supply a base integer to the start() method (typically a certificate you know of), and it will either increment the value and download or decrement, which you can change in the _modifyId() function. It limits to 100 and then quits downloading, this can be altered.
const request = require('request');
const cheerio = require('cheerio');
const http = require('https');
const fs = require('fs');
class CertificateDownloader {
constructor() {
this.limit = 100;
@lanekatris
lanekatris / enable-cors.org.example.js
Created February 24, 2016 22:43
cors_express_node
app.use(function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
next();
});
app.get('/', function(req, res, next) {
// Handle the get for this route
});
// Installing node on linux
// https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora
// Basic Express App
var express = require('express');
var app = express();
app.get('/', function (req, res) {
console.log('Root URL hit');
res.send('Hello World!');
# Renew dhcp ip address
sudo dhclient -r
sudo dhclient
sudo dhclient -r eth0
sudo dhclient eth0
# Find runlevel of the system (multi-user.target=runlevel3, graphical.target=runlevel5)
systemctl get-default
# Set runlevel
declare @schemaName nvarchar(100) = 'item'
declare @tableName nvarchar(100) = 'location'
declare @dataType nvarchar(100) = 'decimal'
select
s.name,
t.name,
c.name,
c.is_nullable,
st.name
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
exclude-result-prefixes="msxsl">
<xsl:output method="xml" indent="yes"/>
<xsl:template name="Put.InventoryUpdate">
<AspDotNetStorefrontImport Version="7.1">
string dir = "c:\sites\app\Content\Images\Rank\1000\";
string fileName = "image1.jpg";
if (!Directory.Exists(dir))
Directory.CreateDirectory(dir);
file.SaveAs(dir + fileName);
var domainTeam = new Team() { Name = "Team 1", Description = "..." };
public class TeamRepository
{
public void Create(Team team)
{
// Don't forget to do your Mapper.Map<> in your bootstrap code in Global.asax or something or you'll get an unknown map error
var entityFrameworkTeam = Mapper.Map<Entities.Team>(team);
// db.add