Skip to content

Instantly share code, notes, and snippets.

View ARezaK's full-sized avatar
💭
dying

ARK ARezaK

💭
dying
View GitHub Profile
@ARezaK
ARezaK / monitor_memcache.sh
Created April 29, 2024 00:40
Send Memcache stats to Slack url
#!/bin/bash
# run with cron 0 17 * * *
# Run the command and capture the output
output=$(echo "stats" | nc -q 1 localhost 11211)
# Parse the output for desired stats
bytes=$(echo "$output" | grep "STAT bytes " | awk '{print $3/1024/1024}')
limit_maxbytes=$(echo "$output" | grep "STAT limit_maxbytes " | awk '{print $3/1024/1024}')
curr_connections=$(echo "$output" | grep "STAT curr_connections " | awk '{print $3}')
@ARezaK
ARezaK / gungeon_cheat.py
Created May 10, 2019 15:59
Cheat at enter the gungeon by constantly entering slow-mo
import keyboard
import time
flag = False
def execute():
global flag
flag = not flag
@ARezaK
ARezaK / firstaid.py
Created February 18, 2017 18:17
extract text from first aid
#this is extremely ugly but I made it in 20 minutes so take it or leave it
import textract
from collections import Counter
text = textract.process("FA2016Unedited.pdf", method='pdfminer')
utftext = text.decode('utf8', errors='ignore')
ascii_ = utftext.encode('ascii', errors='ignore').lower().replace(',',' ').replace('.','').replace('(','').replace(')','')
stopwords = ['what','who','is','you', 'a','at','is','he', 'of', 'and', 'in', 'as', 'to', 'the', 'with', 'a', 'for', 'is', 'A', 'from', 'caused', 'eg', 'image', 'are', 'following', 'have', 'due', 'can', 'this', 'step', 'most', 'makes', 'common', 'and/or', 'work', 'dr.', 'but', 'effect', 'which', 'right', 'left', 'occur', 'clinical', 'review', 'pages', 'it', 'no', 'human', '+', '-', ':', 'that', 'section', 'syndrome', '(eg', 'cell', 'disease', 'may', 'available', 'that', 'under', 'iii','cells', 'associated', 'not', 'ou', 'work', 'derivative', 'work', 'use', 'type', 'adapted', 'source', 'courtesy', 'your', 'effects', 'cause', 'risk', 'been', 'all', '
@ARezaK
ARezaK / designer.html
Last active August 29, 2015 14:14
designer
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-menu/core-submenu.html">
<link rel="import" href="../paper-input/paper-input.html">
<link rel="import" href="../paper-button/paper-button.html">
@ARezaK
ARezaK / print objects
Created October 27, 2014 01:41
Print variables by inspecting them
import inspect
def my_print(var):
callers_local_vars = inspect.currentframe().f_back.f_locals.items()
print str([var_name for var_name, var_val in callers_local_vars if var_val is var]) + " is " + str(var)
@ARezaK
ARezaK / auto_retry_get
Created October 27, 2014 01:39
Auto retrying GET using requests
def fetch_url(url, num_of_tries):
i = 0
while i < num_of_tries:
try:
content = requests.get(url, verify=False)
if content.status_code != 200:
print content.status_code
print content.text
raise Exception("Not 200")
return content