Skip to content

Instantly share code, notes, and snippets.

f_ffx() {
if [[ -n $6 ]]; then
FDR=$(find . -type d | grep -i $1 | grep -i $2 | grep -i $3 | grep -i $4 | grep -i $5 | grep -i $6 | head -n 1)
cd $FDR
return;
elif [[ -n $5 ]]; then
FDR=$(find . -type d | grep -i $1 | grep -i $2 | grep -i $3 | grep -i $4 | grep -i $5 | head -n 1)
cd $FDR
return;
<?php
define('n',"\n");
function g() {
$o=[];
exec('xclip -o',$o);
return implode(n,$o);
}
$console_log = [];
$php_log=[];
function cl($a) {
global $console_log, $php_log;
if (is_object($a)) {
$a=(array)$a;
}
else if (is_array($a)) {
foreach ($a as $i => $d) {
if (is_object($d)) {
xgit() {
if [[ -n $1 ]]; then
git add .; git commit -m "$1 $2 $3 $4 $5 $6 $7 $8"
return;
fi
clear
git diff .
git status .
}
alias x=xgit
silent_findnn() {
if [[ -n $2 ]]; then
find $2 -type f -iname "*$1*" 2> "/home/a/find/err/$1" > "/home/a/find/$1" &
return; fi
find . -type f -iname "*$1*" 2> "/home/a/find/err/$1" > "/home/a/find/$1" &
}
alias sfn=silent_findnn
alias fns=silent_findnn
@magemore
magemore / crawler.go
Last active September 12, 2023 13:20
simple domains crawler go lang million in 24h from cheap laptop on 10Mb/s connection
package main
import (
"fmt"
"net"
"net/http"
"io/ioutil"
"os"
"bufio"
"log"
@magemore
magemore / open.js
Created March 1, 2016 01:20
playing testing site with phantomjs
console.log('Loading a web page');
var page = require('webpage').create();
page.viewportSize = { width: 1000, height: 500 };
page.clipRect = {
top: 0,
left: 0,
width: 1000,
height: 800
};
var url = 'http://www.example.com/admin/';
@magemore
magemore / php_str_replace.cpp
Last active February 2, 2016 21:24
c++ php str_replace analog using std string
std::wstring str_replace(std::wstring search, std::wstring replace, std::wstring subject)
{
std::wstring result = subject;
if (subject.length() == 1) {
if (subject == search) return replace;
}
else if (subject.length() > 1) {
std::string::size_type start_pos = 0;
std::string::size_type search_length = search.length();
std::string::size_type replace_length = replace.length();
@magemore
magemore / gist:4499587
Created January 10, 2013 04:56
Amazon Linux AMI (Fedora) install htop
# update
sudo yum -y update
sudo yum -y upgrade
# enable EPEL6 by changing enabled=0 -> enabled=1
sudo vim /etc/yum.repos.d/epel.repo
# install htop
sudo yum install htop
@magemore
magemore / categories-api.php
Created May 26, 2012 18:40
Using Magento API to create categories
<?php
class Categories
{
private $client;
private $session;
private $tree;
private $categories;
public function __construct()