I hereby claim:
- I am et-cs on github.
- I am etaycs (https://keybase.io/etaycs) on keybase.
- I have a public key ASBHrvlxp6BouxTJaCNQXzkDfP3h7MsLTF52UAZOKvj1DQo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| #!/bin/bash | |
| # this script clear logs in Linux (made in CentOS) | |
| cd /var/log | |
| truncate -s 0 /var/log/*log | |
| find . -name "*.gz" -type f -delete | |
| find . -name "*.0" -type f -delete | |
| find . -name "*.1" -type f -delete | |
| find . -name "*.log.*" -type f -delete |
| #!/usr/bin/env python | |
| import requests | |
| import simplejson as json | |
| # this function fetch your user data from the so api | |
| def get_data(): | |
| # replace '3879958' with your userid | |
| url = "https://api.stackexchange.com/2.2/users/3879958?order=desc&sort=reputation&site=stackoverflow" | |
| j=json.loads((requests.get(url, timeout=5)).text) | |
| return j |
| #!/bin/sh | |
| df -H | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $1 }' | while read output; | |
| do | |
| usep=$(echo $output | awk '{ print $1}' | cut -d'%' -f1 ) | |
| partition=$(echo $output | awk '{ print $2 }' ) | |
| if [ $usep -ge 90 ]; then | |
| echo "Running out of space \"$partition ($usep%)\" on $(hostname) as on $(date)" | | |
| mail -s "Alert: Almost out of disk space $usep%" [email protected] | |
| fi | |
| done |
| import twitter | |
| from twitter import TwitterError | |
| TWITTER_CONSUMER_KEY = 'your consumer key' | |
| TWITTER_CONSUMER_SECRET = 'your consumer secret' | |
| TWITTER_ACCESS_TOKEN_KEY = 'your token key' | |
| TWITTER_TOKEN_SECRET = 'your token secret' | |
| def get_twitter_followers(): | |
| try: |
| #!/bin/bash | |
| # This script made in centos - you may need to change the command above according to your system | |
| # ------------------------------------------ | |
| # Website status checker. | |
| # save all websites to check in file named 'websites.txt'. each in new line. | |
| # end file with empty line. | |
| # ------------------------------------------ | |
| # Quiet mode. enable to disable echo's command. for crontab, etc. |
| import requests | |
| import simplejson as json | |
| # UPDATED to use API (v3) | |
| def get_youtube_followers(): | |
| url = "https://www.googleapis.com/youtube/v3/channels?part=statistics&forUsername=[UserName]&key=[API-Key]" | |
| j=json.loads((requests.get(url, timeout=5)).text) | |
| return j['items'][0]['statistics']['subscriberCount'] |
| import requests | |
| import simplejson as json | |
| def get_github_followers(): | |
| url = "https://api.github.com/users/ET-CS" | |
| j=json.loads((requests.get(url)).text) | |
| return str(j['followers']) |
| public class PreferencesActivity extends PreferenceActivity { | |
| ... | |
| @Override | |
| protected void onCreate(Bundle savedInstanceState) { | |
| super.onCreate(savedInstanceState); | |
| // find the CheckBox | |
| CheckBoxPreference chkbox = (CheckBoxPreference) findPreference(getString(R.string.chkboxid)); | |
| // set OnClick listener | |
| chkbox.setOnPreferenceClickListener(chkboxListener); |
| public class MyService extends IntentService { | |
| ... | |
| private class DisplayToast implements Runnable{ | |
| String mText; | |
| public DisplayToast(String text){ | |
| mText = text; | |
| } |