Skip to content

Instantly share code, notes, and snippets.

@Intey
Intey / gist:b4cbeb2971a1586a55f8
Created July 3, 2014 14:07
delete pattern from each file in current directory(recursively).
@echo off
Setlocal enabledelayedexpansion
echo %filePath%
Set "pattern=.paycrypt@gmail_com"
Set "replace="
echo "replace" %replace%
echo "Pattern " %pattern%
for /f "usebackq tokens=* delims=" %%# in (`dir /b /S /A:-D`) Do (
Set "File=%%~nx#"
(define (guide-middle-box image drawable bwidth bheight)
(let* (
(width (car (gimp-image-width image)))
(height (car (gimp-image-height image)))
(vmargin (/ (- width bwidth) 2))
(hmargin (/ (- height bheight) 2)))
(if (and
(<= bwidth width)
(<= bheight height))
(begin
@Intey
Intey / CIFF.py
Last active August 29, 2015 14:22
crossplatform Include filenames fixer for C++ projects.
""" Replace UPPERCASE chars in filenames to lowercase,
and (in future) fix include directives respectively to new filenames. It's
needed for cross-platform compilation C++ code: on Windows, you can not doubt
about headers name. But, when you try to build it on *nix system case does
matter.
Usage:
renamer.py DIRECTORY [--dry-run]
renamer.py (-h | --help)
Options:
# display type;path of removable devices(usb, cdrom etc.).
awk '{ if ($3 == 1) { print $2";"$1 }}' <(lsblk -p —output=NAME,TYPE,RM)
#!/bin/python3
import sys
import os
packs=[]
deps=[]
packs = sys.argv[1:]
if not packs:
@Intey
Intey / Ls.sh
Created October 1, 2015 08:12
helpful shell command pipe
# dirs that childs of some_dir and their childs.
find some_dir -mindepth 1 -maxdepth 2 -type d
# though pipe, send it to ls to display permissions, without read content of given dirs
xargs ls -ldF
@Intey
Intey / road-to-web.markdown
Last active July 5, 2016 11:21
По просьбам, инфа за то, как прийти в веб, что читать и т.п.

Направления, ключи

JS, HTML, CSS - стандарт. Даже если идти в backend-разрабы - всеравно нужно.

Frontend - разработка морды. Дизайнер задает общий вид, рисует макеты, а фронтовик превращает это в рабочее приложение.

Backend - рабочая часть приложения. Мозги, тут бизнес-логика везде. Заодно и БД и API.

Обучалки

@Intey
Intey / inotifywait.bash
Created December 11, 2016 11:45
wait file change and execute
#!/bin/bash
file=$1
shift
let changed=0
while [[ $changed -eq 0 ]]; do
inotifywait -e CLOSE_WRITE $file -qo /dev/null && changed=$?
echo "update with: $@"
$@
@Intey
Intey / main.cpp
Created October 11, 2017 18:44
C++14 style
#include <vector>
#include <functional>
#include <memory>
#include <iostream>
using namespace std;
class Unit
{
public:
@Intey
Intey / main.c
Last active November 1, 2018 18:36
#include <stdio.h> // scanf, printf
#include <math.h> // pow
int slen(char* s) {
int res = 0;
while(*s) { res++; s++; }
return res;
}
int fromBin(char* s) {