Skip to content

Instantly share code, notes, and snippets.

View ik5's full-sized avatar
🎯
Focusing

ik5 ik5

🎯
Focusing
View GitHub Profile
@ik5
ik5 / run-workers.sh
Created July 26, 2019 15:54
Creating 10 workers, takes the host ip using docker
#!/usr/bin/env bash
declare -i min=0
declare -i max=10
host=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+')
for (( c=min; c<max; c++ )) do
echo "Going to start worker # $c"
docker run\
@ik5
ik5 / build.sh
Created January 2, 2020 09:26
shared object from go to c (re-take)
#!/usr/bin/env sh
echo "Building go library:"
go build -o libtest.so -buildmode=c-shared ./main.go || exit
echo "Building C executible:"
clang --verbose -DUSE_SHARED_LLVM=on -L/tmp/so -ltest -I/tmp/so main.c -o main -Wall || exit
echo "Done"
@ik5
ik5 / audio_windows.go
Last active October 2, 2020 05:12
Quick and dirty audio playing for MS Windows (No error validation) in Golang
// +build windows
package main
import (
"fmt"
"path/filepath"
"syscall"
"unsafe"
)
@ik5
ik5 / concat-wav.go
Created March 8, 2020 08:55
example on concating two (or more) wav files
package main
import (
"io"
"io/ioutil"
"github.com/moutend/go-wav"
)
func main() {

Assembly Language / Reversing / Malware Analysis -resources

Twitter: Muffin

⭐Assembly Language

@ik5
ik5 / israeli_id.py
Created September 7, 2020 18:26
calc israeli id number for valid last number in python 2
#!/usr/bin/env python2
def validate_id_number(id_num):
anID = id_num.zfill(9)
return sum(
sum(
map(
int, str(int(a)*(i % 2 + 1))
)
@ik5
ik5 / html_dom_example.php
Last active September 9, 2020 06:51
A simple example on reading a PHP <head> tag and print it's content including attributes
<?php
$doc = new DOMDocument();
$doc->loadHTMLFile('test.html', LIBXML_NOWARNING | LIBXML_NOERROR);
$nodes = $doc->getElementsByTagName('head');
if ($nodes->length <= 0) {
die('no head found');
}
@ik5
ik5 / main.go
Created February 7, 2021 14:48
Example for getting machine hostname and all of it's IP numbers based on local devices
package main
import (
"fmt"
"net"
"os"
"strings"
)
// GetMachineInfo return a list of:
@ik5
ik5 / main.go
Last active June 23, 2021 17:19
Example on how to look for the date based on a day of the week
package main
import (
"fmt"
"time"
)
func main() {
t, _ := time.Parse("2006-01-02 15:04", "2021-05-17 10:55")
today := t.Weekday()
@ik5
ik5 / thread_pool.rb
Last active October 10, 2021 06:42
example on how to do threadpool in ruby
require 'thread'
queue = Queue.new
threads = []
1.step(1000) do |i|
queue << i
end
8.times do