Skip to content

Instantly share code, notes, and snippets.

@mdukat
mdukat / bmp-gen.c
Last active March 6, 2019 14:18
bmp generator (2x2)
#include <stdlib.h>
#include <stdio.h>
#define BITMAP_SIZE 16
struct __attribute__((__packed__)) bmpHeader {
short BM; //const "BM"
unsigned int fileSize; // oblicz se xD
unsigned int reserved; // byle co, nawet papiesz
unsigned int bitmapOffset;
set nocompatible
set nu
set smartindent
nnoremap <F10> :tabp<CR>
nnoremap <F11> :tabn<CR>
nnoremap <c-o> :tabe<space>
nnoremap <F12> :close<CR>
nnoremap <C-F12> :close!<CR>
nnoremap <S-F12> :vnew<CR>
@mdukat
mdukat / lolcode.vim
Created May 26, 2019 14:01
LOLCODE syntax for vim
" LOLCODE syntax
" d3s
syn keyword lolFunc HAI
syn keyword lolFunc CAN HAS
syn keyword lolFunc VISIBLE
syn keyword lolFunc KTHXBYE
syn keyword lolFunc PLZ OPEN
syn keyword lolFunc AWSUM THX
syn keyword lolFunc O NOES
@mdukat
mdukat / varlogbackup.sh
Created June 14, 2019 08:23
Simple, easily extensible, /var/log backup script
#!/bin/bash
# Variables (aka config)
# Script executed after making backup of /var/log (none for no script to execute)
passScript=""
# Remove syslog, auth.log, kern.log, after backup? ("true"/"false")
removeAfterVarlog="true"
# Remove backup tar from /tmp. Good when uploading with passScript ("true"/"false")
removeAfterTar="false"

Yandex.Disk REST API How To (quick af)

This will be modified, don't worry

1. Register

Simply make standard account on disk.yandex.com

2. Register App Client

First thing to do is to register new App Client. This can be done in oauth.yandex.com.

  • Click on "Create new client" button

Docs cheatsheet (delete me)

  • [server_name] - server name
  • [image_name] - os image name
  • [image_md5] - os image md5sum
  • [image_sha256] - os image sha256sum
  • [image_download] - os image download link
  • [image_size] - os image size
  • [kernel_version] - kernel version number (uname -r)
  • [kernel_oob_config] - is kernel out-of-box (true/false)
  • [kernel_config_name] - custom kernel config name
#!/bin/bash
# Simple wifi data logger
# d3s
pingSite='onet.pl'
wifiName=$(nmcli connection show | head -2 | tail -1 | sed 's/ .*//g')
echo $wifiName
wifiIp=$(curl -s https://ipinfo.io/ip)
echo $wifiIp
#!/bin/bash
# Usage:
# cat list_of_links.txt | ./zippyshare-downloader.sh
# or
# ./zippyshare-downloader.sh [link]
function _download {
refererLink=${1}
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#define PORT 6667
#ifndef DEBUG
#define FREENODE "107.182.226.199" // chat.freenode.org
#else
@mdukat
mdukat / sed.sh
Created October 24, 2019 17:51
Quick sed example of \1, \2, etc
#!/bin/bash
# \(.\) matches one character, which will be available by \1
# \(.*\) matches one or more characters, which will be available by \1
# & places whole input, without changes
ls Lolishit* | sed 's/ /\\ /g' | sed 's/\(.*\)-.*$/mv & \1.flac/' | sh