Skip to content

Instantly share code, notes, and snippets.

View lubry's full-sized avatar
💭
I may be slow to respond.

Lubriady Oktana lubry

💭
I may be slow to respond.
View GitHub Profile
@lubry
lubry / qcow2vdi.md
Created March 8, 2024 04:15 — forked from denji/qcow2vdi.md
convert a qcow2 vm to a VirtualBox vm format

VirtualBox command-line interface (VBoxManage) provides an easy way to convert raw disk image to the VDI/VMDK format and otherwise.

Let's assume that we have raw image of the sdb device:

$ sudo dd if=/dev/sdb of=./sdb.raw

To use it with VirtualBox we need to convert it to the VDI format:

$ VBoxManage convertdd sdb.raw sdb.vdi --format VDI
@lubry
lubry / qcow2vdi.sh
Created March 8, 2024 04:15 — forked from mamonu/qcow2vdi.sh
convert a qcow2 vm to a VirtualBox vm format
qemu-img convert -O vdi gnome.qcow2 gnome.vdi
#if its a raw image then:
VBoxManage convertdd opnstk.raw VBox.vdi --format VDI
@lubry
lubry / CMakeLists.txt
Created March 7, 2024 03:26
graphqlparser/python/CMakeLists.txt
FIND_PROGRAM(CTYPESGEN_FOUND ctypesgen.py)
IF (NOT CTYPESGEN_FOUND)
FIND_PROGRAM(CTYPESGEN_FOUND ctypesgen)
ELSEIF (CTYPESGEN_FOUND)
ADD_CUSTOM_COMMAND(
OUTPUT GraphQLParser.py
COMMAND ctypesgen.py ${CMAKE_CURRENT_SOURCE_DIR}/../c/*.h ${CMAKE_CURRENT_BINARY_DIR}/../c/*.h -o ${CMAKE_CURRENT_SOURCE_DIR}/GraphQLParser.py -I ${CMAKE_CURRENT_SOURCE_DIR}/.. -I ${CMAKE_CURRENT_BINARY_DIR}/.. -l graphqlparser -L ${CMAKE_CURRENT_BINARY_DIR}/.. 2>&1 > /dev/null
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/../c/GraphQLAstForEachConcreteType.h ${CMAKE_CURRENT_BINARY_DIR}/../c/GraphQLAst.h ${CMAKE_CURRENT_SOURCE_DIR}/../c/GraphQLAstNode.h ${CMAKE_CURRENT_SOURCE_DIR}/../c/GraphQLAstVisitor.h ${CMAKE_CURRENT_SOURCE_DIR}/../c/GraphQLParser.h
)
ADD_CUSTOM_TARGET(
  1. First get to the existing directory
    $ cd my/folder/

  2. Now start a new git repository
    $ git init

  3. Identify if the current elements on the directory are needed or not and add them to the .gitignore file. When ready...
    $ vim .gitignore

  4. When ready create the first commit on the server

$ git pull origin master //run this first, then
$ git push origin master
hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caused by another repository pushing hint: to the same ref. You may want to first integrate the remote changes hint: (e.g., 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.
@lubry
lubry / post.py
Created July 5, 2023 02:35 — forked from iknowjason/post.py
Data exfiltration using curl and python SimpleHTTPServer class
from http.server import HTTPServer, BaseHTTPRequestHandler
class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):
def do_GET(self):
self.send_response(200)
self.end_headers()
self.wfile.write(b'Hello, world!')
def do_POST(self):
content_length = int(self.headers['Content-Length'])
@lubry
lubry / k8sdump.sh
Created December 13, 2022 03:09 — forked from xykong/k8sdump.sh
Export Kubernetes cluster resource to yaml.
#!/usr/bin/env bash
readonly SCRIPT=$(basename "$0")
readonly VERSION='1.0.0'
readonly AUTHOR='[email protected]'
readonly SOURCE='https://gist.github.com/xykong/6efdb1ed57535d18cb63aa8e20da3f4b'
# For script running robust
set -o nounset # to exit when your script tries to use undeclared variables
set -o errexit # to make your script exit when a command fails
@lubry
lubry / filter.d_nginx-auth.conf
Created November 18, 2022 10:26 — forked from JulienBlancher/filter.d_nginx-auth.conf
Fail2ban Config with Nginx and SSH
#
# Auth filter /etc/fail2ban/filter.d/nginx-auth.conf:
#
# Blocks IPs that makes too much accesses to the server
#
[Definition]
failregex = ^<HOST> -.*"(GET|POST).*HTTP.*"
ignoreregex =
@lubry
lubry / accesslog2csv.py
Created October 20, 2022 07:00 — forked from joswr1ght/accesslog2csv.py
Convert Apache/Nginx Unified Log Format to CSV
# accesslog2csv: Convert default, unified access log from Apache, Nginx
# servers to CSV format.
#
# Original source by Maja Kraljic, July 18, 2017
# Modified by Joshua Wright to parse all elements in the HTTP request as
# different columns, December 16, 2019
import csv
import re
@lubry
lubry / Binary location for SENDMAIL.txt
Created June 10, 2022 02:36
Binary location for SENDMAIL in csf.conf is either incorrect, is not installed or is not executable
Error Code:
*WARNING* Binary location for [SENDMAIL] [] in /etc/csf/csf.conf is either incorrect, is not installed or is not executable
*WARNING* Missing or incorrect binary locations will break csf and lfd functionality
● lfd.service - ConfigServer Firewall & Security - lfd
Loaded: loaded (/lib/systemd/system/lfd.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2022-06-10 09:30:45 WIB; 8ms ago
Process: 74188 ExecStart=/usr/sbin/lfd (code=exited, status=0/SUCCESS)
Main PID: 74218 (lfd - starting)