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
<job id="main"> | |
<script language="VBScript"> | |
' Copyright(c)2010 ET-CS (Etay (ET) Cohen-Solal) | |
' Set here your variables: | |
' Backup Folder | |
path = "C:\MyFolder" | |
' Destination Folder To Archive Backups. Don't Forget The Ending BackSlash '\' |
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
public class MyService extends IntentService { | |
... | |
private class DisplayToast implements Runnable{ | |
String mText; | |
public DisplayToast(String text){ | |
mText = text; | |
} |
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
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); |
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 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']) |
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 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'] |
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 | |
# 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. |
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 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: |
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/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 |
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
#!/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 |
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 | |
# 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 |
OlderNewer