Skip to content

Instantly share code, notes, and snippets.

View bgunebakan's full-sized avatar

Bilal Tonga bgunebakan

View GitHub Profile
@bgunebakan
bgunebakan / gist:aa85ded369e5aff1f452
Last active August 29, 2015 14:15
get ip address of interface.if interface does not exist i will return 'no connection interface'
import netifaces
satInterface = 'ppp0' #finding interface
interfaceList = netifaces.interfaces() #create interface list
if satInterface in interfaceList: #find interface in list
netifaces.ifaddresses(satInterface) #get ip
ip = netifaces.ifaddresses(satInterface)[2][0]['addr']
print ip
@bgunebakan
bgunebakan / gist:18c14e327e19a82deceb
Created February 11, 2015 14:04
find raspi on network
sudo nmap -sO 192.168.2.* -p22
#it will be shown as ;
Nmap scan report for 192.168.2.109
Host is up (0.00076s latency).
PROTOCOL STATE SERVICE
22 closed xns-idp
MAC Address: B8:27:EB:0C:FE:5A (Raspberry Pi Foundation)
@bgunebakan
bgunebakan / mysql.c
Last active August 29, 2015 14:12
mysql c api test code
/* Simple C program that connects to MySQL Database server
*
* compile with $(mysql_config --cflags) mysql-c-api.c $(mysql_config --libs)
*dependencies: libmysql-dev mysql-client
*/
#include <mysql.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
@bgunebakan
bgunebakan / datetime.c
Created January 6, 2015 20:24
get date and time with c
/* Simple C program that connects to MySQL Database server*/
#include <stdio.h>
#include <string.h>
#include <time.h>
int main(){
time_t t = time(NULL);
@bgunebakan
bgunebakan / wiegand.c
Last active August 29, 2015 14:12 — forked from hsiboy/wiegand.c
/*
* Wiegand API Raspberry Pi
* By Kyle Mallory All rights reserved.
* 12/01/2013
* Based on previous code by Daniel Smith (www.pagemac.com) and Ben Kent (www.pidoorman.com)
* Depends on the wiringPi library by Gordon Henterson: https://projects.drogon.net/raspberry-pi/wiringpi/
*
* This is linked with -lpthread -lwiringPi -lrt
*
* The Wiegand interface has two data lines, DATA0 and DATA1. These lines are normall held
sudo mount /dev/sda6 /mnt
sudo mount --bind /dev /mnt/dev &&
sudo mount --bind /dev/pts /mnt/dev/pts &&
sudo mount --bind /proc /mnt/proc &&
sudo mount --bind /sys /mnt/sys
sudo chroot /mnt
AddDefaultCharset UTF-8
<VirtualHost *:80>
ErrorLog /var/www/test/logs/error.log
CustomLog /var/www/test/logs/access.log combined
WSGIScriptAlias / /var/www/test/application.wsgi
Alias /robots.txt /var/www/test/robots.txt