Skip to content

Instantly share code, notes, and snippets.

View jameskraus's full-sized avatar

James Kraus jameskraus

View GitHub Profile
@jdimpson
jdimpson / socatandudp.txt
Created May 8, 2019 20:39
socat and UDP
(originally written in 2009 and posted to livejournal! https://jdimpson.livejournal.com/6812.html
The last article teaches how to use socat by comparing it first to cat then to netcat. It skimped on socat's UDP-related features, because netcat only implements a subset of them. This article picks up where the last one left off, with respect to UDP. After this article will be one more that discusses advanced socat features.
It turns out there are a lot of subleties when dealing with UDP, even before multicast is mixed in. We'll abandon the comparisons to netcat, as we've exceeded what netcat can do. But first a quick reminder of one way socat does UDP.
socat as a UDP server on port 11111.
socat STDIO UDP-LISTEN:11111
@markddavidoff
markddavidoff / slack-pagerduty-oncall.py
Created February 27, 2019 05:24 — forked from devdazed/slack-pagerduty-oncall.py
Updates a Slack User Group with People that are on call in PagerDuty
#!/usr/bin/env python
from __future__ import print_function
import json
import logging
from urllib2 import Request, urlopen, URLError, HTTPError
from base64 import b64decode
@jslatts
jslatts / ReactConfig.cs
Last active May 17, 2021 05:44
webpack config for React.NET with server side bundle
ReactSiteConfiguration.Configuration.AddScriptWithoutTransform("~/wwwroot/ng-server.bundle.js");
ReactSiteConfiguration.Configuration.JsonSerializerSettings = new Newtonsoft.Json.JsonSerializerSettings
{
ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore,
};
// Don't use slower IE engine
ReactSiteConfiguration.Configuration.AllowMsieEngine = false;
@mp4096
mp4096 / ppt2pdf.ps1
Created April 28, 2016 10:56
Batch convert PowerPoint files to PDF
# Batch convert all .ppt/.pptx files encountered in folder and all its subfolders
# The produced PDF files are stored in the invocation folder
#
# Adapted from http://stackoverflow.com/questions/16534292/basic-powershell-batch-convert-word-docx-to-pdf
# Thanks to MFT, takabanana, ComFreek
#
# If PowerShell exits with an error, check if unsigned scripts are allowed in your system.
# You can allow them by calling PowerShell as an Administrator and typing
# ```
# Set-ExecutionPolicy Unrestricted

Folder Structure

Please note

While this gist has been shared and followed for years, I regret not giving more background. It was originally a gist for the engineering org I was in, not a "general suggestion" for any React app.

Typically I avoid folders altogether. Heck, I even avoid new files. If I can build an app with one 2000 line file I will. New files and folders are a pain.

@stalmok
stalmok / jpegtran-directory.sh
Last active December 11, 2015 04:39 — forked from rik/jpegtran-directory.sh
Bash: Optimize .jpg images
#!/usr/bin/env bash
function optimize
{
echo $1
filesize=`stat --format=%s "$1"`
if [[ $filesize -lt 10000 ]]; then
jpegtran -copy none -optimize "$1" > "$1.bak"
echo "pet"
else