Skip to content

Instantly share code, notes, and snippets.

@sepehr
sepehr / blockstack.txt
Created Dec 20, 2017
Blockstack proof
View blockstack.txt
Verifying my Blockstack ID is secured with the address 19qPLyc5KHs1y6eBSB6JQTBPMTXuWVASce https://explorer.blockstack.org/address/19qPLyc5KHs1y6eBSB6JQTBPMTXuWVASce
@sepehr
sepehr / num_endianness.php
Created Aug 1, 2017
Change endianness of a decimal number in PHP
View num_endianness.php
<?php
/**
* Change endianness of the given decimal number.
*
* @param int $num
*
* @return int
*/
function num_endianness($num) {
@sepehr
sepehr / virality-updater-memory-profile.svg
Created Jun 21, 2017
virality-updater-memory-profile
View virality-updater-memory-profile.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sepehr
sepehr / tmux.cheat
Created Jan 22, 2017 — forked from afair/tmux.cheat
Tmux Quick Reference & Cheat sheet - 2 column format for less scrolling!
View tmux.cheat
========================================== ==========================================
TMUX COMMAND WINDOW (TAB)
========================================== ==========================================
List tmux ls List ^b w
New -s <session> Create ^b c
Attach att -t <session> Rename ^b , <name>
Rename rename-session -t <old> <new> Last ^b l (lower-L)
Kill kill-session -t <session> Close ^b &
@sepehr
sepehr / pgp.md
Last active Jun 8, 2021
PGP Guide
View pgp.md

PGP Guide

GPG vs PGP

PGP can refer to two things:

The Pretty Good Privacy software originally written by Phil Zimmermann, and now owned by Symantec. The formats for keys, encrypted messages and message signatures defined by that software. These have now been formalised as the OpenPGP standard. The GPG software is an independent implementation of the OpenPGP standards, so you can use it to exchange encrypted messages with people using other OpenPGP implementations (e.g. Symantec's PGP).

@sepehr
sepehr / ubuntu-web.md
Last active Jun 4, 2021
Webserver recipe for Ubuntu 14.04
View ubuntu-web.md

Webserver setup recipe for Ubuntu 14.04 LTS

A few notes:

  • All commands should be run as root unless specified otherwise.
  • Commands that sould be run locally have a local$ prefix.

Initial setup

Hostname

@sepehr
sepehr / osx-kong.sh
Last active Jun 12, 2018
OSX: Kong Installation
View osx-kong.sh
#!/bin/bash
#
# The homebrew formula of kong has a lot of version incompatibilities. So
# we install kong directly from Luarocks.
#
# Kong only works with Cassandra 2.1.x/2.2.x, the latest brew formula for
# cassandra is 3.x. We need to tap homebrew/versions and install cassandra22
# instead.
#
@sepehr
sepehr / malware_cleaner.sh
Last active Nov 10, 2015
PHP/Drupal Malware Remover
View malware_cleaner.sh
# Observe the mess, exclude the unnecessary
#
# -r: Recursive
# -I: Skip binaries
#
grep -rI --color "return base64_decode(\\$.*);" /path/to/www/root
# Clean the mess
#
# -r: Recursice
@sepehr
sepehr / svn_commit_amend.sh
Last active Nov 10, 2015
SVN: Update latest commit message
View svn_commit_amend.sh
# Try svn info and replace SVN_REPO_REMOTE_ADDRESS
svn propset --revprop -r {REVISION_NUMBER} --force "svn:log" "NEW_COMMIT_MESSAGE_HERE..." SVN_REPO_REMOTE_ADDRESS
@sepehr
sepehr / rm_biggies.sh
Last active Nov 10, 2015
Shell: Find & remove files bigger than X
View rm_biggies.sh
# k: Kilobyte, M: Megabyte, G: Gigabyte
# +: Bigger than, -: Lower than
find . -maxdepth 1 -type f -size +500k -exec rm -f {} \;
# Or better:
find . -maxdepth 1 -type f -size +50M -delete
# Let's have a look first:
find . -maxdepth 1 -type f -size +2G -exec ls -lhS {} \; | awk {print $5 "\t" $9}