Skip to content

Instantly share code, notes, and snippets.

View nhalstead's full-sized avatar
👨‍💻
Something. Maybe cool

Noah Halstead nhalstead

👨‍💻
Something. Maybe cool
View GitHub Profile
@shalkam
shalkam / formsy-draft-wsisyg.js
Created May 18, 2017 13:04
Formsy react-draft-wysiwyg component
import React from 'react';
import Formsy, { HOC } from 'formsy-react';
import { Editor } from 'react-draft-wysiwyg';
import { EditorState, convertToRaw } from 'draft-js';
import 'react-draft-wysiwyg/dist/react-draft-wysiwyg.css';
import { stateToHTML } from 'draft-js-export-html';
import { stateFromHTML } from 'draft-js-import-html';
class Draft extends React.Component {
state = {
editorState: EditorState.createEmpty(),
<?php
//status.php?id=USER_ID
include('db.php');
if($_GET['id'])
{
//variables
$id=mysqli_real_escape_string($con,$_GET["id"]);
@blaskovicz
blaskovicz / humanDuration.js
Last active July 22, 2024 13:58
humanDuration.js
function humanDuration(number, unit = "s") {
let result;
switch (unit) {
case "ns":
result = number / 1000000;
if (result < 1) break;
number = result;
unit = "ms";
case "ms":
result = number / 1000;
@iffy
iffy / .gitignore
Last active January 8, 2025 06:32
Example using electron-updater with `generic` provider.
node_modules
dist/
yarn.lock
wwwroot
#!/bin/bash
address=https://ilo.mysite.com:34043
username=Administrator
password=********
session_key=$(
curl -fsS \
--insecure \
"$address/json/login_session" \
@mnadel
mnadel / kcdo
Last active February 14, 2023 07:36
Exec Across (Some, All) Pods in Kubernetes
#!/usr/bin/env bash
PROGNAME=$(basename $0)
function usage {
echo "usage: $PROGNAME [-n NAMESPACE] [-m MAX-PODS] -s SERVICE -- COMMAND"
echo " -s SERVICE K8s service, i.e. a pod selector (required)"
echo " COMMAND Command to execute on the pods"
echo " -n NAMESPACE K8s namespace (optional)"
echo " -m MAX-PODS Max number of pods to run on (optional; default=all)"
@tommyready
tommyready / CloudFlareApiClient.cs
Last active January 4, 2024 17:52
Update Cloud Flare DNS Record via Cloud Flare API v4 using C#
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using Newtonsoft.Json;
namespace CloudFlareApiClient
{
class Program
{

How to add an image to a gist

  1. Create a gist if you haven't already.
  2. Clone your gist:
    # make sure to replace `<hash>` with your gist's hash
    git clone https://gist.github.com/<hash>.git # with https
    git clone [email protected]:<hash>.git     # or with ssh
package main
import (
"fmt"
"github.com/gorilla/mux"
"log"
"net/http"
"net/http/httputil"
)
@tommyready
tommyready / config\config.php
Last active February 10, 2025 21:39
Using PHP to read MINECRAFT PlayerData JSON files for Player Stats
<?php
DEFINE('_MINECRAFT_SERVER_DIRECTORY_','C:\Minecraft Server Files');