Skip to content

Instantly share code, notes, and snippets.

View hugmatj's full-sized avatar

J Hughes hugmatj

  • Beard Brother Services
  • Bradenton Florida
View GitHub Profile
@hugmatj
hugmatj / tmux-template
Created April 1, 2023 05:31 — forked from schnell18/tmux-template
tmux template
#!/bin/sh
# Check to see if we're already running the session
tmux has-session -t main &> /dev/null
if [ $? != 0 ] ; then
# Create overall tmux session
tmux new-session -d -s main -n java > /dev/null
tmux split-window -v
@hugmatj
hugmatj / create_chrootjail.sh
Created April 1, 2023 05:30 — forked from icy/create_chrootjail.sh
Script to automate the creation of chroot jail w/ minimal executables to run git.
#!/bin/sh
# script to automate the creation of chroot jail
# w/ minimal executables to run git
export CHROOT=/var/chroot
function copy_binary() {
for i in $(ldd $*|grep -v dynamic|cut -d " " -f 3|sed 's/://'|sort|uniq)
do
cp --parents $i $CHROOT
@hugmatj
hugmatj / tmux-cheatsheet.markdown
Created March 8, 2023 18:33 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@hugmatj
hugmatj / gist:a2f15fe05fd7bf8d155835df06007a26
Created April 19, 2022 21:39
Uses math.random to randomly increase bets. Start out covering a long losing streak and occasionally bet a shorter streak. Betting is based on balance. easy to change.
chance = 39.6
martimulti = 1.85 --multiplier for loses
streak = 20 -- cover 20 bets
risk = (martimulti ^ streak) * (streak/(streak *(martimulti - 1)))
boomstreak = 13 -- cover 13 bets on a Boom
boomrisk = (martimulti ^ boomstreak) * (boomstreak/(boomstreak *(martimulti - 1)))
startbalance = balance
<?php
/**
* Define google url shortener api
*/
define("API_URL", "https://www.googleapis.com/urlshortener/v1/url?key=");
class GoogleURL
{
/**
*
import socket
msgFromClient = "Hello UDP Server"
bytesToSend = str.encode(msgFromClient)
serverAddressPort = ("127.0.0.1", 20001)
bufferSize = 1024
# Create a UDP socket at client side
UDPClientSocket = socket.socket(family=socket.AF_INET, type=socket.SOCK_DGRAM)
@hugmatj
hugmatj / skeleton-daemon.sh
Created November 13, 2021 00:29 — forked from teocci/skeleton-daemon.sh
A template to write a quick daemon as a bash script
#!/bin/sh
# This is a skeleton of a bash daemon. To use for yourself, just set the
# daemonName variable and then enter in the commands to run in the doCommands
# function. Modify the variables just below to fit your preference.
daemonName="DAEMON-NAME"
pidDir="."
pidFile="$pidDir/$daemonName.pid"
@hugmatj
hugmatj / page.html
Created November 13, 2021 00:27 — forked from teocci/page.html
A simple CSS Tooltips
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Tooltips</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
@hugmatj
hugmatj / workerman-ws-all-workers.php
Created November 13, 2021 00:21 — forked from teocci/workerman-ws-all-workers.php
Send data to all workers, global user, id btw workers
<?php
use Workerman\Worker;
require_once __DIR__ . '/vendor/autoload.php';
// Channel Server.
$channel_server = new Channel\Server('0.0.0.0', 2206);
$worker = new Worker('websocket://0.0.0.0:4236');
// 6 processes.
$worker->count=6;
@hugmatj
hugmatj / logAllNotifications.m
Created October 18, 2021 20:09 — forked from Jesse-calkin/logAllNotifications.m
NSLog notifications from App Delegate: http://jessecalkin.com/code-test/
[[NSNotificationCenter defaultCenter] addObserverForName:nil
object:nil
queue:nil
usingBlock: ^(NSNotification *notification) {
NSLog(@"Received Notification:\n%@\n%@",
notification.name,
notification.userInfo);
}];