Skip to content

Instantly share code, notes, and snippets.

View thebentern's full-sized avatar

Ben Meadors thebentern

View GitHub Profile
@thebentern
thebentern / TSQL-to-POCO
Created October 6, 2023 21:42 — forked from joey-qc/TSQL-to-POCO
A simple TSQL script to quickly generate c# POCO classes from SQL Server tables and views. You may tweak the output as needed. Not all datatypes are represented but this should save a bunch of boilerplate coding. USAGE: Run this query against the database of your choice. The script will loop through tables, views and their respective columns. Re…
declare @tableName varchar(200)
declare @columnName varchar(200)
declare @nullable varchar(50)
declare @datatype varchar(50)
declare @maxlen int
declare @sType varchar(50)
declare @sProperty varchar(200)
DECLARE table_cursor CURSOR FOR
@thebentern
thebentern / test.sh
Created February 23, 2020 13:43
FFMPEG Live RTMP HLS Test
ffmpeg -listen 1 -i rtmp://area61.better-than.tv:1935/ANYTV_USR_BRITISH10/BRITISH10.sdp \
-c:v libx264 -crf 21 -preset veryfast \
-c:a aac -b:a 128k -ac 2 \
-f hls -hls_time 4 -hls_playlist_type event stream.m3u8
@thebentern
thebentern / letsencrypt.sh
Created June 4, 2017 22:56
Renew letsencrypt cert
sudo letsencrypt renew
@thebentern
thebentern / Create-DockerContainerHostEntry.ps1
Created April 13, 2017 11:19
Create hosts file entry for docker dynamically by name
function Replace-HostEntry ($targetDns, $newIpAddress) {
$hostsPath = "$env:windir\System32\drivers\etc\hosts"
$hosts = Get-Content $hostsPath
$hosts = $hosts -replace "^.+$targetDns", "$newIpAddress $targetDns"
$hosts | Out-File $hostsPath -enc ascii
}
function Get-DockerIpByImageName($imageName) {
$container = docker ps | Select-String $imageName
@thebentern
thebentern / git-revert.sh
Created March 17, 2017 13:32
Revert back to specific commit and preserve commit history
git revert --no-commit 0766c053..HEAD
git commit
@thebentern
thebentern / Restore-SqlBackup.ps1
Created January 29, 2017 15:19
Powershell Backup and Restore Sql Server Database
#
# Example
# Restore-SqlBackup -serverInstance TARDIS\SQLEXPRESS -backupFile C:\DATA\TestDatabase.bak -targetDatabase TestDatabaseClone
#
function Restore-SqlBackup($serverInstance, $backupFile, $targetDatabase) {
$server = New-Object Microsoft.SqlServer.Management.Smo.Server $serverInstance;
$dataFolder = $server.Settings.DefaultFile;
$logFolder = $server.Settings.DefaultLog;
@thebentern
thebentern / ubnt-dyndns.sh
Last active September 17, 2022 06:32
Setup namecheap dynamic dns for ubnt edgerouter
configure
set service dns dynamic interface eth0 service namecheap host-name <host>
set service dns dynamic interface eth0 service namecheap login <username>
set service dns dynamic interface eth0 service namecheap password <password>
commit
save
exit
@thebentern
thebentern / launch.json
Created December 8, 2016 22:08
Ruby on Rails launch.json
configurations": [
{
"name": "Rails server",
"type": "Ruby",
"request": "launch",
"cwd": "${workspaceRoot}",
"program": "${workspaceRoot}/bin/rails",
"args": ["server"]
}
]
@thebentern
thebentern / hummus.md
Last active March 3, 2017 01:59
Black-eyed pea hummus

Black-eyed pea hummus

Ingredients

  • 2 x 15.5 oz cans of Trappy's jalapeno black-eyed peas cooked and rinsed
  • 3/4 cup of tahini
  • 3 cloves of fresh garlic
  • 1/4 cup of oil (I used avocado)
  • 1 lemon juiced
  • 2 tsp salt
@thebentern
thebentern / gulpfile.js
Last active October 7, 2016 14:32
.NET Core App Coverage and Report gulp
var gulp = require("gulp"),
rimraf = require("rimraf"),
concat = require("gulp-concat")
exec = require("gulp-exec");
gulp.task('report', ['test'], function(cb) {
return exec('ReportGenerator.exe -reports:coverage.xml" -targetdir:"coverage\"');
});
gulp.task('test', function(cb) {