Skip to content

Instantly share code, notes, and snippets.

@ek-nath
ek-nath / EndpointSecurityDemo.m
Created December 20, 2022 18:17 — forked from Omar-Ikram/EndpointSecurityDemo.m
A demo of using Apple's EndpointSecurity framework - tested on macOS Monterey 12.2.1 (21D62)
//
// main.m
// EndpointSecurityDemo
//
// Created by Omar Ikram on 17/06/2019 - macOS Catalina 10.15 Beta 1 (19A471t)
// Updated by Omar Ikram on 15/08/2019 - macOS Catalina 10.15 Beta 5 (19A526h)
// Updated by Omar Ikram on 01/12/2019 - macOS Catalina 10.15 (19A583)
// Updated by Omar Ikram on 31/01/2021 - macOS Big Sur 11.1 (20C69)
// Updated by Omar Ikram on 07/05/2021 - macOS Big Sur 11.3.1 (20E241)
// Updated by Omar Ikram on 04/07/2021 - macOS Monterey 12 Beta 2 (21A5268h)
@ek-nath
ek-nath / ssh_server.dockerfile
Created March 11, 2022 19:08
OpenSSH server dockerfile
FROM ubuntu:latest
RUN apt update && apt install openssh-server sudo -y
RUN useradd -rm -d /home/ubuntu -s /bin/bash -g root -G sudo -u 1000 test
RUN echo 'test:test' | chpasswd
RUN service ssh start
@ek-nath
ek-nath / install_podman_wsl_ub2004.sh
Created March 11, 2022 19:01
Podman wsl ubuntu 20.04
# Root shell
echo 'deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_20.04/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list
curl -L https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_20.04/Release.key | sudo apt-key add -
apt update
apt install podman -y
@ek-nath
ek-nath / fix_wsl_dns.ps1
Created November 4, 2021 19:16
Cisco Anyconnect WSL DNS fix
echo "Getting DNS nameservers"
$ns = Get-DnsClientServerAddress -AddressFamily IPv4 | Select-Object -ExpandProperty ServerAddresses | %{ "nameserver " + $_;}
echo "Getting search domains"
$sd = Get-DnsClientGlobalSetting | Select-Object -ExpandProperty SuffixSearchList | %{ "search " + $_;}
echo "-----------------------"
echo $ns
echo $sd
@ek-nath
ek-nath / set_display.py
Created September 27, 2018 16:28
Ubuntu monitor/display switcher
#!/usr/bin/env python3
import sys
import os
# 1. Run `xrandr -q | grep connected` to identify what the correct display IDs are
# 2. set keyboard shortcuts like <ctrl>+<super>+<alt>+1 to call /home/username/set_display.py desktop
if len(sys.argv) <= 1:
sys.argv.append("all")
if sys.argv[1].strip() == "laptop":
@ek-nath
ek-nath / amsi-eicar.py
Created December 21, 2017 22:56
Demo python script for AMSI API
# Python Port of https://gist.github.com/richinseattle/1cafd9368890ecf3d8e1dbbc18f2fe38
from ctypes import HRESULT, windll, POINTER, byref
from ctypes.wintypes import HANDLE, LPCWSTR, UINT, LPCSTR
from enum import IntEnum
from comtypes.hresult import S_OK
class AMSI_RESULT(IntEnum):
AMSI_RESULT_CLEAN = 0,
AMSI_RESULT_NOT_DETECTED = 1
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// default font size in pixels for all tabs
fontSize: 12,
// font family with optional fallbacks
#include <moderngpu/transform.hxx>
using namespace mgpu;
int main(int argc, char** argv) {
// The context encapsulates things like an allocator and a stream.
// By default it prints device info to the console.
standard_context_t context;
// Launch five threads to greet us.
@ek-nath
ek-nath / pub.py
Created July 21, 2014 07:53
pylibrabbitmq noticeable difference in timing data.
from datetime import datetime
import librarbbitmq
msg = 'x'*20000
M_PROP = {'delivery_mode': 1}
connection = librabbitmq.connecetion(...)
channel = connection.channel()
start = datetime.now()
for _ in xrange(count):
connection._basic_publish(1, msg, X, RK, M_PROP, False, False)