Skip to content

Instantly share code, notes, and snippets.

@ii0
ii0 / install-tmux.sh
Created May 6, 2023 03:03 — forked from muralisc/install-tmux.sh
Install tmux 3.0a on Amazon Linux 2 / rhel /centos
# Install tmux 3.0a on Centos
# install deps
sudo yum install -y gcc kernel-devel make ncurses-devel
# DOWNLOAD SOURCES FOR LIBEVENT AND MAKE AND INSTALL
curl -LOk https://github.com/libevent/libevent/releases/download/release-2.1.11-stable/libevent-2.1.11-stable.tar.gz
tar -xf libevent-2.1.11-stable.tar.gz
cd libevent-2.1.11-stable
./configure --prefix=/usr/local
@ii0
ii0 / paramiko_example.py
Created May 5, 2023 00:41 — forked from batok/paramiko_example.py
Paramiko example using private key
import paramiko
k = paramiko.RSAKey.from_private_key_file("/Users/whatever/Downloads/mykey.pem")
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
print "connecting"
c.connect( hostname = "www.acme.com", username = "ubuntu", pkey = k )
print "connected"
commands = [ "/home/ubuntu/firstscript.sh", "/home/ubuntu/secondscript.sh" ]
for command in commands:
print "Executing {}".format( command )
@ii0
ii0 / .gitconfig
Created April 6, 2023 05:46 — forked from johnpolacek/.gitconfig
My current .gitconfig aliases
[alias]
co = checkout
cob = checkout -b
coo = !git fetch && git checkout
br = branch
brd = branch -d
brD = branch -D
merged = branch --merged
st = status
aa = add -A .
@ii0
ii0 / websocketgames.go
Created March 8, 2023 11:52 — forked from tsilvers/websocketgames.go
Golang code to send binary image data to client through a websocket connection.
package main
import (
"flag"
"fmt"
"html/template"
"log"
"net/http"
"time"
@ii0
ii0 / reconn.go
Created March 7, 2023 08:54 — forked from navono/reconn.go
websocket reconnect in golang
package reconWS
import (
"errors"
"math/rand"
"net/http"
"net/url"
"sync"
"time"
@ii0
ii0 / screenshot.cpp
Created February 23, 2023 12:30 — forked from prashanthrajagopal/screenshot.cpp
Take a screenshot and save as jpeg in c++
#include <stdio.h>
#include <windows.h>
#include <gdiplus.h>
#include <time.h>
int GetEncoderClsid(const WCHAR* format, CLSID* pClsid) {
using namespace Gdiplus;
UINT num = 0;
UINT size = 0;
@ii0
ii0 / CaptureSceenshotUsingOpenCV.cpp
Created February 23, 2023 12:30 — forked from SuperKogito/CaptureSceenshotUsingOpenCV.cpp
Code for my blog post <https://superkogito.github.io/blog/CaptureScreenUsingOpenCv.html> A snippet for capturing the screen content using OpenCV
/*****************************************************************************************************************
* \file CaptureSceenshotUsingOpenCV.cpp
* \brief capture screenshot using OpenCV and save it as a png.
*
* \author SuperKogito
* \date July 2020
*
* @note:
* references and sources:
* - http://msdn.microsoft.com/en-us/library/windows/window/dd183402%28v=vs.85%29.aspx
@ii0
ii0 / pcap_replay.py
Created February 16, 2023 01:35 — forked from danielinux/pcap_replay.py
replay a captured pcap stream
#!/usr/bin/python
from scapy.all import *
import time, sys
pkts = rdpcap(sys.argv[1])
clk = pkts[0].time
for p in pkts:
time.sleep(p.time - clk)
clk = p.time
sendp(p)
@ii0
ii0 / init_script
Created December 16, 2022 03:50 — forked from emmanuelnk/init_script
Install Redis Server on Amazon Linux AMI EC2
#!/bin/sh
# From - http://www.codingsteps.com/install-redis-2-6-on-amazon-ec2-linux-ami-or-centos/
#
# redis - this script starts and stops the redis-server daemon
#
# chkconfig: - 85 15
# description: Redis is a persistent key-value database
# processname: redis-server
# config: /etc/redis/redis.conf
# config: /etc/sysconfig/redis
@ii0
ii0 / chmod-400.cmd
Created November 28, 2022 04:43 — forked from jaskiratr/chmod-400.cmd
Set permission of file equivalent to chmod 400 on Windows.
# Source: https://stackoverflow.com/a/43317244
$path = ".\aws-ec2-key.pem"
# Reset to remove explict permissions
icacls.exe $path /reset
# Give current user explicit read-permission
icacls.exe $path /GRANT:R "$($env:USERNAME):(R)"
# Disable inheritance and remove inherited permissions
icacls.exe $path /inheritance:r