Skip to content

Instantly share code, notes, and snippets.

View gr8linux's full-sized avatar
🏠
Working from home

Mohammad gr8linux

🏠
Working from home
View GitHub Profile
#!/bin/python3
from urllib.request import Request, urlopen
from urllib.error import URLError, HTTPError
import sys,time
import threading
from socket import timeout
def geturls(ufilename):
ulist = []
#!/bin/python3
from urllib.request import Request, urlopen
from urllib.error import URLError, HTTPError
import sys
def geturls(ufilename):
ulist = []
with open(ufilename,'r') as ufile:
#!/bin/bash
# lock dirs/files
LOCKDIR="/tmp/statsgen-lock"
PIDFILE="${LOCKDIR}/PID"
# exit codes and text
ENO_SUCCESS=0; ETXT[0]="ENO_SUCCESS"
ENO_GENERAL=1; ETXT[1]="ENO_GENERAL"
ENO_LOCKFAIL=2; ETXT[2]="ENO_LOCKFAIL"
#!/bin/sh -e
### BEGIN INIT INFO
# Provides: dnscrypt-proxy
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Should-Start: $network $syslog
# Should-Stop: $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
@gr8linux
gr8linux / _service.md
Created March 13, 2016 16:14 — forked from naholyr/_service.md
Sample /etc/init.d script

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
#!/bin/sh
# This is for the file /etc/init.d/dnscrypt
### BEGIN INIT INFO
# Provides: dnscrypt
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: DNSCrypt for OpenDNS
# Description: Launch the dnscrypt to communicate with OpenDNS
@gr8linux
gr8linux / .vimrc
Last active August 29, 2015 14:25 — forked from jinie/.vimrc
set nocompatible " be iMproved
filetype on "Avoid errors on close
filetype off " required!
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" Bundles {{{-
" let Vundle manage Vundle
" required!
@gr8linux
gr8linux / rapi-media
Last active August 29, 2015 14:09
Raspberry Pi media center
1- First Expand the filesystem & Enable the SSH and Changing the default user "pi" password
2- Change the locale and timezone
3- Configure the Wifi to connect into the internet
http://www.maketecheasier.com/setup-wifi-on-raspberry-pi/
sudo echo -e "\n# Disable power management\noptions 8192cu rtw_power_mgnt=0" >>/etc/modprobe.d/8192cu.conf # disable the power saving
http://raspisimon.no-ip.org/ipaddress.php
or
https://coderwall.com/p/v290ta/raspberry-pi-wifi-setup-with-wpa2-psk-aes
4- Connect via ssh
#define ANALOG_IN 0
void setup() {
Serial.begin(9600);
//Serial.begin(115200);
}
void loop() {
int val = analogRead(ANALOG_IN);
Serial.write( 0xff );
/*
* Oscilloscope
* Gives a visual rendering of analog pin 0 in realtime.
*
* This project is part of Accrochages
* See http://accrochages.drone.ws
*
* (c) 2008 Sofian Audry (info@sofianaudry.com)
*
* This program is free software: you can redistribute it and/or modify