Skip to content

Instantly share code, notes, and snippets.

View KristobalJunta's full-sized avatar
🇺🇦

Eugene KristobalJunta

🇺🇦
View GitHub Profile
@KristobalJunta
KristobalJunta / disable-scroll.js
Created August 25, 2015 11:36
A JS to toggle scrolling w/o hiding scrollbar
// disable scrolling without hiding scrolbar
document.onmousewheel=document.onwheel=function(){
return false;
};
document.addEventListener("MozMousePixelScroll",function(){return false},false);
document.onkeydown=function(e) {
if (e.keyCode>=33&&e.keyCode<=40) return false;
}
// enabling in again
@KristobalJunta
KristobalJunta / duhast.sh
Created December 13, 2016 14:35
Du Hast by espeak
#!/bin/bash
spd-say -l de -r -50 "du"
sleep 1
spd-say -l de -r -50 "du hast"
sleep 1
spd-say -l de -r -50 "du hast mich"
sleep 1.5
#spd-say -l de -r -50 "du hast mich"
#sleep 1.5
@KristobalJunta
KristobalJunta / mailer.php
Last active December 13, 2016 14:44
Vanilla php scipt to send emails via X-Mailer
<?php
$db_host = 'hostname';
$db_user = 'username';
$db_password = 'password';
$db_name = 'database';
$mysqli = new mysqli($db_host, $db_user, $db_password, $db_name);
if ($mysqli->connect_errno) {
#!/bin/sh
TODO_DIR=~/todos/
TODO_PREFIX="TODO-"
mkdir -p $TODO_DIR
cd $TODO_DIR
# copy most recent* TODO file
# *recent = using filename, not last edited! So filenames need to be in a sane date format, like YYYY-MM-DD
RECENT_TODO=`ls -1 | head -n1`
# use this if you want to use last edited instead
@KristobalJunta
KristobalJunta / halloween.py
Created October 5, 2017 00:07
Spooky scary python code; A Halloween gist
import random
TRICK = False
TREAT = random.choice(['Trick', 'Treat'])
@KristobalJunta
KristobalJunta / install_nginx_vim.sh
Created June 21, 2019 15:01
Install Nginx conf syntax for vim
#!/bin/sh
mkdir -p ~/.vim/syntax/
cd ~/.vim/syntax/
wget http://www.vim.org/scripts/download_script.php?src_id=19394
mv download_script.php\?src_id\=19394 nginx.vim
cat > ~/.vim/filetype.vim <<EOF
au BufRead,BufNewFile /etc/nginx/*,/usr/local/nginx/conf/* if &ft == '' | setfiletype nginx | endif
EOF
@KristobalJunta
KristobalJunta / carbon-config.json
Created July 9, 2019 18:28
My config for carbon.now.sh
{
"paddingVertical": "6px",
"paddingHorizontal": "9px",
"marginVertical": "45px",
"marginHorizontal": "45px",
"backgroundImage": null,
"backgroundImageSelection": null,
"backgroundMode": "color",
"backgroundColor": "rgba(255,255,255,1)",
"dropShadow": true,
@KristobalJunta
KristobalJunta / JSONSerializable.py
Created August 27, 2019 20:12
A dict-serializable (JSON compatible) mixin for SQLAlchemy models
# -*- coding: utf-8 -*-
class JSONSerializable:
def _serialize(self, value):
if type(value) not in (int, float, bool, type(None)):
return str(value)
return value
def as_dict(self):
@KristobalJunta
KristobalJunta / heididecode.py
Last active October 29, 2019 10:05
Decode passwords stored in HeidiSQL
#!/usr/bin/env python
from __future__ import print_function
import sys
def heidi_decode(hexstr):
shift = int(hexstr[-1])
l = [int(hexstr[i:i+2], 16) for i in range(0, len(hexstr), 2)]
return ''.join(chr(v - shift) for v in l)
@KristobalJunta
KristobalJunta / pyproject.toml
Created March 6, 2020 09:57
This set of dependencies makes poetry resolve them for a very long time
[tool.poetry]
name = "example_project"
version = "0.1.0"
description = "Dependencies for this resolve for eternity"
authors = []
[tool.poetry.dependencies]
python = "^3.5"
awscli = "^1.15"
google-api-python-client = "^1.7.4"