This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# checks to see if running | |
launchctl list | grep elasticsearch | |
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.elasticsearch.plist | |
launchctl remove homebrew.mxcl.elasticsearch | |
pkill -f elasticsearch | |
rm -f ~/Library/LaunchAgents/homebrew.mxcl.elasticsearch.plist |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# generate slug | |
UPDATE table_name SET slug = replace(trim(lower(name)), ' ', '-'); | |
# check irregular slug.. | |
SELECT * FROM table_name WHERE slug NOT RLIKE '^([a-z0-9]+\-)*[a-z0-9]+$'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import re | |
import json | |
import unidecode | |
def slugify(text): | |
text = unidecode.unidecode(text).lower() | |
return re.sub(r'\W+', '-', text) | |
if (sys.version_info[0] < 3): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
dir="/Users/cengizhan/images" | |
find $dir -type f -name '*.png' -print0 | while IFS= read -r -d '' file; do | |
convert "$file" "${file%.*}.jpg" | |
rm -f $file | |
echo "$file converted" | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class RateLimit | |
{ | |
protected $totalTimestamp = 0; | |
protected $totalCalls = 0; | |
protected $timestamp = 0; | |
protected $calls = 0; | |
protected $limit; |
NewerOlder