Skip to content

Instantly share code, notes, and snippets.

@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
@ii0
ii0 / fixperms.bat
Created November 28, 2022 04:43 — forked from SathyaBhat/fixperms.bat
fix permissions for "You need permissions from .. to perform this action" in Windows 7
takeown /r /d y /f *
icacls * /reset /t /c /q
import socket
import win32serviceutil
import servicemanager
import win32event
import win32service
import time
import random
from pathlib import Path
@ii0
ii0 / slideshare-downloader.sh
Created November 17, 2022 01:00 — forked from giudinvx/slideshare-downloader.sh
Slideshare Downloader
#!/bin/bash
#-----------------------------------------------
# Modify 4/08/2018 by giudinvx
# Email giudinvx[at]gmail[dot]com
#-----------------------------------------------
# Author: Andrea Lazzarotto
# http://andrealazzarotto.com
# [email protected]