Skip to content

Instantly share code, notes, and snippets.

@cronfy
cronfy / dl-cloud-mail-ru.sh
Last active April 1, 2024 16:58
Download file from cloud.mail.ru from linux console with bash script
#!/usr/bin/env bash
# Скрипт по загрузке публичных файлов с Облака mail.ru. Поддерживается докачка.
# v1.0.5 от 2022-05-30
#
# ЕСЛИ СКРИПТ НЕ РАБОТАЕТ
#
# 1. Убедитесь, что файл доступен публично. Возможна загрузка только публичных файлов.
# 2. Mail.ru время от времени меняет внутрянку, не очень сильно, но требуется адаптация скрипта.
# Если скрипт не работает, просьба сделать работающий форк и скинуть ссылку в комментарии.
@zmts
zmts / passwords.md
Last active July 14, 2023 10:21
Про хранение паролей в БД

Про хранение паролей в БД

При создании нового юзера

  1. При регистрации юзер вводит некий пароль
  2. Генерим случайную соль индивилуально для каждого юзера
  3. Создаем хеш на основе введенного юзером пароля и соли
  4. Записываем хеш(не пароль) в БД + соль в отдельном филде

Авторизация существующего юзера

  1. Юзер вводит в поле авторизации некий пароль
def instacheck(name)
unless /[a-z0-9._]{,30}/.match(name)
return false
end
if /\.\./.match(name)
return false
end
@squarism
squarism / iterm2.md
Last active July 5, 2024 12:03
An iTerm2 Cheatsheet

Tabs and Windows

Function Shortcut
New Tab + T
Close Tab or Window + W (same as many mac apps)
Go to Tab + Number Key (ie: ⌘2 is 2nd tab)
Go to Split Pane by Direction + Option + Arrow Key
Cycle iTerm Windows + backtick (true of all mac apps and works with desktops/mission control)
@sgnl
sgnl / postgres-brew.md
Last active April 21, 2024 23:18
Installing Postgres via Brew (OSX) (outdated see top most note)

Outdated note: the process is a lot easier now: after you brew install postgresql you can initialize or stop the daemon with these commands: brew services start postgresql or brew services stop postgresql.

new out put may look like

To have launchd start postgresql now and restart at login:
  brew services start postgresql
Or, if you don't want/need a background service you can just run:
  pg_ctl -D /usr/local/var/postgres start
@chrismdp
chrismdp / s3.sh
Last active March 5, 2024 12:57
Uploading to S3 in 18 lines of Shell (used to upload builds for http://soltrader.net)
# You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine
# This is how I upload my new Sol Trader builds (http://soltrader.net)
# Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash
S3KEY="my aws key"
S3SECRET="my aws secret" # pass these in
function putS3
{
path=$1
@gskielian
gskielian / git-specify-ssh-key
Created October 14, 2014 16:51
Specifying SSH Key within Git Clone
#how to specify an ssh key to use when cloning a repo in Mac
ssh-agent bash -c 'ssh-add /Users/UR_USERNAME/.ssh/UR_PRIVATE_KEY; git clone git@DAS_GIT_URL'
@jtsternberg
jtsternberg / $-cache.js
Last active May 19, 2020 04:14
jQuery selector cache with reset (original: http://eamann.com/tech/selector-caching-jquery/). If commenting, please ping me on Twitter, same username.
function Selector_Cache() {
var collection = {};
function get_from_cache( selector, reset ) {
if ( undefined === collection[ selector ] || true === reset ) {
collection[ selector ] = jQuery( selector );
}
return collection[ selector ];
}
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active July 4, 2024 17:58
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname