Skip to content

Instantly share code, notes, and snippets.

View handicraftsman's full-sized avatar
🖥️

Nickolay handicraftsman

🖥️
View GitHub Profile
@handicraftsman
handicraftsman / help.md
Last active December 16, 2015 21:10
Basic window class in Vala (GTK3)

Construct it as object

Run it with .show_all()

@handicraftsman
handicraftsman / help.md
Last active December 16, 2015 21:15
Stack in C++
  1. Inheirt stack for using in code. It's not object
  2. To add string to stack, use void push(string in)
  3. To remove and get latest element from stack, use string pop()
  4. To check stack with number 'in', use string peek(int in)
  5. To empry stack, use void empty()
  6. To flush stack to stdout, use void flush()
//You can also change type of this function to any other (if you need)
class ClassMisc {
public static string[] str_arr_cmb(string[] a, string[] b){
string[] output = {};
int cnt = 0;
foreach(string i in a){
output += a[cnt];
cnt++;
@handicraftsman
handicraftsman / obfuscated_facer.rb
Created January 5, 2017 21:35
Just messing with manual obfuscation
=begin
# Unobfuscated code:
s="-^v><*$-".each_char.take 8;loop{print " #{s.sample}_#{s.sample} ";sleep 0.1;print "\r"}
=end
# Obfuscated code:
eval( "" +
"\u0064\u003D\u0022\u0030" +
"\u0030\u0037\u0033\u0030" +
"\u0030\u0033\u0044\u0030" +
@handicraftsman
handicraftsman / cleverbotserv.py
Created January 12, 2017 12:14
Simple CleverBot API.
#!/usr/bin/env python3
# Requires `cleverbot` and `flask` pip packages
# To send message, send POST request with msg=<message>
# You'll receive answer in response body
from cleverbot import Cleverbot
from flask import Flask, redirect, url_for, request
app = Flask(__name__)
cb = Cleverbot()
@handicraftsman
handicraftsman / pass.rb
Last active January 15, 2017 20:19
Generates strong random passwords
require "date"
dt = DateTime.now
base = ("a".."z").to_a + ("A".."Z").to_a + ("0".."9").to_a
blen = base.length
passlen = ARGV[0]
if passlen == "-"
passlen = gets
module.exports = (obj, ...args) => {
return new Promise((res, rej) => {
try {
res(new obj(...args));
} catch (e) {
rej(e);
}
});
}
#pragma once
#include <functional>
#include <memory>
#include <mutex>
template<class T>
class room {
public:
typedef std::shared_ptr<T> ptr;
@handicraftsman
handicraftsman / particlecc.lua
Last active August 2, 2018 10:08
ParticleCC
--[[
The MIT License (MIT)
Copyright (c) 2018 Nickolay Ilyushin
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@handicraftsman
handicraftsman / for.cpp
Created November 3, 2018 10:24
For loop
// same code as in quill part, but in C++
{
int i = 0
contfunc = [&] () { i++; }
while (i < 10) {
std::cout << i << std::endl;
contfunc();
}
std::cout << "Done counting" << std::endl;
}