Skip to content

Instantly share code, notes, and snippets.

@camark
camark / mib_tree.c
Created February 8, 2017 08:43 — forked from begeekmyfriend/mib_tree.c
MIB tree structure demo
/*
* This file is part of SmartSNMP
* Copyright (C) 2014, Credo Semiconductor Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
#include <windows.h>
#pragma comment(lib, "advapi32.lib")
BOOL ShutdownSystem(LPTSTR lpMsg){
HANDLE hToken; // handle to process token
TOKEN_PRIVILEGES tkp; // pointer to token structure
BOOL fResult; // system shutdown flag
// Get the current process token handle so we can get shutdown
@camark
camark / main.cpp
Created October 17, 2016 06:13 — forked from chowey/main.cpp
C++ Win32 Shutdown With Privilages
#include <Windows.h>
int _tmain(int argc, _TCHAR* argv[])
{
HANDLE hToken;
OpenProcessToken(GetCurrentProcess(),
TOKEN_ADJUST_PRIVILEGES |
TOKEN_QUERY,
&hToken);
@camark
camark / vimrc
Created June 13, 2016 00:19 — forked from keelii/vimrc
vimrc for window
" ------------------------------
" Name: vimrc for windows
" Author: keelii
" Email: [email protected]
" ------------------------------
" Startup {{{
filetype indent plugin on
augroup vimrcEx
@camark
camark / pymysqlconn.py
Created June 6, 2016 01:02 — forked from maltzsama/pymysqlconn.py
python working with mysql
#!/usr/bin/python
# versao.py – captura e mostra a versão do MySQL database server.
# importe os modulos do MySQLdb e sys
import MySQLdb
import sys
# Abra uma conexão com o banco de dados
# Tenha certeza de ter trocado o IP, usuario, senha e database para os seus.
connection = MySQLdb.connect (host = “192.168.1.1″, user = “username”, passwd = “password”, db = “database_name”)
from datetime import datetime
import hashlib
import MySQLdb
conn = MySQLdb.connect (host = "localhost", user = "root", passwd = '',db = "spider",charset = 'utf8')
cursor = conn.cursor ()
#INSERTION/UPDATE Statements
sql="insert ignore into url_queue select * from something"
cursor.execute(sql)
conn.commit()