Skip to content

Instantly share code, notes, and snippets.

View ik5's full-sized avatar
🎯
Focusing

ik5 ik5

🎯
Focusing
View GitHub Profile
@ik5
ik5 / colors.go
Last active April 8, 2024 14:25
Simple golang expirement with ANSI colors
package main
// http://play.golang.org/p/jZ5pa944O1 <- will not display the colors
import "fmt"
const (
InfoColor = "\033[1;34m%s\033[0m"
NoticeColor = "\033[1;36m%s\033[0m"
WarningColor = "\033[1;33m%s\033[0m"
ErrorColor = "\033[1;31m%s\033[0m"
DebugColor = "\033[0;36m%s\033[0m"

Assembly Language / Reversing / Malware Analysis -resources

Twitter: Muffin

⭐Assembly Language

@ik5
ik5 / custom_json_unmarshal.go
Last active November 2, 2023 12:59
Example of custom unmarshal of JSON in golang
package main
import (
"encoding/json"
"fmt"
"reflect"
)
type To []string
@ik5
ik5 / dynamic_method.pas
Created June 18, 2012 21:17
How dynamically execute a method in Object Pascal Class
{$mode objfpc}{$M+}
program test;
type
TMyClass = class
procedure SayHi;
end;
procedure TMyClass.SayHi;
begin
@ik5
ik5 / time_format.go
Created November 9, 2016 09:04
A full example of all possible time formats in Golang
package main
import (
"fmt"
"time"
)
func main() {
fmt.Println("Times: ")
t := time.Now()
@ik5
ik5 / prefix_function.sql
Created January 6, 2022 07:10
example on how to use postgresql to find the biggest prefix from content at a table
CREATE OR REPLACE FUNCTION public.prefixes(character varying) RETURNS character varying[]
LANGUAGE sql IMMUTABLE
AS $_$
SELECT ARRAY(SELECT substring($1 FROM 1 FOR i)
FROM generate_series(1, GREATEST(length($1))) g(i))::varchar[];
$_$
SELECT MAX(prefix) FROM MY_TABLE WHERE prefix=ANY(content);
@ik5
ik5 / notify_watch.php
Created October 24, 2021 16:52
PECL inotify example for close_write on watch directory
<?php
$fd = inotify_init();
$watch_descriptor = inotify_add_watch($fd, './watch', IN_CLOSE_WRITE);
while (true) {
$events = inotify_read($fd);
foreach ($events as $event) {
@ik5
ik5 / read_stdin.php
Created October 24, 2021 16:40
example on reading from stdin in php
<?php
while (!feof(STDIN)) {
$f = fgets(STDIN);
if ($f) {
echo ">> $f\n";
}
}
@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
@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()