Skip to content

Instantly share code, notes, and snippets.

View crmaxx's full-sized avatar

Maxim Zhukov crmaxx

  • Russia, Vladimir
View GitHub Profile
@crmaxx
crmaxx / gist:6e245d7b28a0311a350c112444aa0841
Created March 7, 2018 15:57 — forked from andrekandore/gist:3140554
AES128, AES256 encrypt/decrypt in Ruby
require "openssl"
require "digest"
def aes128_encrypt(key, data)
key = Digest::MD5.digest(key) if(key.kind_of?(String) && 16 != key.bytesize)
aes = OpenSSL::Cipher.new('AES-128-CBC')
aes.encrypt
aes.key = key
aes.update(data) + aes.final
end
@crmaxx
crmaxx / enum_str_repr.rs
Last active March 6, 2018 12:20 — forked from wtfaremyinitials/enum_str_repr.rs
Rust enum with str representation
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
struct ParseError;
macro_rules! enum_with_str_representation {
(enum $enum_name:ident {
$($variant:ident => $nice_name:expr,)+
}) => {
#[derive(Debug, PartialEq, Eq, Clone, Hash)]
enum $enum_name {
$($variant),+
@crmaxx
crmaxx / test.rs
Created January 9, 2018 14:44 — forked from retep998/test.rs
Linking Rust using LLVM and MSVC. No MinGW at all.
// Let's build rust programs with msvc linker!
// Started by klutzy
// Continued by Retep998
// Command line
/*
SET PATH=C:\WINDOWS;C:\WINDOWS\System32;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64;A:\rust64\bin;A:\LLVM\bin
rustc libcore\lib.rs --target=x86_64-pc-windows -Car=llvm-ar
rustc test.rs --emit=obj --target=x86_64-pc-windows --extern core=libcore.rlib
link "test.o" "libcore.rlib" "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" "libcmt.lib" /LIBPATH:"C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x64" /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib\amd64"
@crmaxx
crmaxx / puma.service
Created June 30, 2017 10:19 — forked from arteezy/puma.service
Manage Puma with systemd on Ubuntu 16.04 and rbenv
[Unit]
Description=Puma Rails Server
After=network.target
[Service]
Type=simple
User=deploy
WorkingDirectory=/home/deploy/app/current
ExecStart=/home/deploy/.rbenv/bin/rbenv exec bundle exec puma -C /home/deploy/app/shared/config/puma.rb
ExecStop=/home/deploy/.rbenv/bin/rbenv exec bundle exec pumactl -S /home/deploy/app/shared/tmp/pids/puma.state stop
@crmaxx
crmaxx / rails-puma.service
Created June 30, 2017 10:19 — forked from velenux/rails-puma.service
systemd service to start rails/puma
# based on https://gist.github.com/twtw/5494223
# create systemd service file for rails/puma startup
# 0. [if required: rvm use ruby@default]
# 1. rvm wrapper default systemd rails
# 2. put this file in /etc/systemd/system/rails-puma.service
# 3. systemctl enable rails-puma
# 4. systemctl start rails-puma
[Unit]
Description=Rails-Puma Webserver
@crmaxx
crmaxx / number.js
Created June 3, 2017 23:18 — forked from FGRibreau/times.js
Ruby .times & .upto & .downto methods in JavaScript
// Ruby = 5.times { |i| puts i }
// JS = (1).times(function(i){console.log(i);})
Number.prototype.times = function(cb) {
var i = -1;
while (++i < this) {
cb(i);
}
return +this;
@crmaxx
crmaxx / ExecJavaScript.ps1
Created March 7, 2017 13:59 — forked from omidkrad/ExecJavaScript.ps1
PowerShell function to run JavaScript/JQuery and return results back to PS, with timeout
# PowerShell function to run JavaScript/JQuery and return results back to PS, with timeout
# some web page with jQuery in it
$url = "http://jquery.com/"
Function ResetTimer
{
$script:startTime = [DateTime]::Now
}
@crmaxx
crmaxx / psibuild.command
Created February 17, 2017 12:31 — forked from bvp/psibuild.command
Psi+ build script for Mac OS X
#!/bin/bash
#######################################################################
# #
# Universal build script of Psi+ under MacOS X #
# Универсальный скрипт сборки Psi+ под MacOS X #
# #
#######################################################################
# REQUIREMENTS / ТРЕБОВАНИЯ
@crmaxx
crmaxx / Kali 2.0 ISO Build
Created October 18, 2016 11:47 — forked from jgamblin/Kali 2.0 ISO Build
Build Your Own Kali 2.0 ISO
##################################################################
Install live-build
##################################################################
sudo apt-get install live-build
##################################################################
Git clone the live-build configs
##################################################################
git clone git://git.kali.org/live-build-config.git
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.HashSet;
import java.util.Set;
// billion-laughs-style DoS for java serialization
public class SerialDOS {