This file contains 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
// set location of docx text content file | |
$xmlFile = $targetDir."/word/document.xml"; | |
$reader = new XMLReader; | |
$reader->open($xmlFile); | |
// set up variables for formatting | |
$text = ''; $formatting['bold'] = 'closed'; $formatting['italic'] = 'closed'; $formatting['underline'] = 'closed'; $formatting['header'] = 0; | |
// loop through docx xml dom | |
while ($reader->read()){ |
This file contains 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
# Proxy class created by "tomer filiba" at http://code.activestate.com/recipes/496741-object-proxying/ | |
class Proxy(object): | |
__slots__ = ["_obj", "__weakref__"] | |
def __init__(self, obj): | |
object.__setattr__(self, "_obj", obj) | |
# | |
# proxying (special cases) | |
# | |
def __getattribute__(self, name): | |
return getattr(object.__getattribute__(self, "_obj"), name) |
This file contains 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
const sendMessage = (recipientID, link, message) => { | |
const url = ("http://www.facebook.com/dialog/send?" + | |
"app_id=" + appId + | |
"&link=" + encodeURI(link) + | |
"&to=" + recipientID + | |
"&display=popup" + | |
"&redirect_uri=" + encodeURI(link)); | |
chrome.tabs.create({ url }, (tab) => { | |
const msg_val = 'document.querySelector("#feedform_user_message").value'; | |
chrome.tabs.executeScript(tab.id, { |
This file contains 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/local/bin/python3 | |
# -*- python -*- | |
''' | |
Owner : Moshe J. Gordon Radian | |
Description : DNS utilities using dnslib. | |
Based on: https://github.com/samuelcolvin/dnserver | |
Some resources about DNS: | |
- http://www.slashroot.in/what-dns-zone-file-complete-tutorial-zone-file-and-its-contents | |
- https://computer.howstuffworks.com/dns.htm |
This file contains 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
#include <stdio.h> | |
char txt[] = { | |
[(0 << 0) ... ((1 << 0) - 1)] = '0', | |
[(1 << 0) ... ((1 << 1) - 1)] = '1', | |
[(1 << 1) ... ((1 << 2) - 1)] = '2', | |
[(1 << 2) ... ((1 << 3) - 1)] = '3', | |
[(1 << 3) ... ((1 << 4) - 1)] = '4', | |
[(1 << 4) ... ((1 << 5) - 1)] = '5', | |
'\0' |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<style> | |
.item1 { | |
grid-area: myArea; | |
} | |
.grid-container { | |
display: grid; | |
grid-template-areas: |
This file contains 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
#include <stdio.h> | |
// https://gcc.gnu.org/onlinedocs/cpp/Concatenation.html | |
#define test(a) b ## a | |
int main(void) { | |
char* bc = "Hello World\n"; | |
printf(test(c)); | |
return 0; | |
} |
This file contains 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
#include <stdio.h> | |
#include <stdint.h> | |
typedef struct __attribute__((__packed__)) data_block_t { | |
uint8_t a; | |
uint8_t b : 1; | |
uint8_t c : 1; | |
uint8_t d : 1; | |
uint8_t e : 1; | |
uint8_t f : 1; |
This file contains 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 # pip install requests | |
from functools import reduce | |
import json | |
from pprint import pprint, pformat | |
def create_mlnx_os_session(switch_ip, user_name, password, https=True, verify=False): | |
''' | |
@summary: | |
Using the requests library create a session with a MLNX-OS running machine, that can serve both web and JSON requests | |
@param switch_ip: |
This file contains 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
#include <Python.h> | |
#include <string.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#define bail_null(obj) \ | |
if (NULL == obj) { err = 1; goto bail; } | |
#define bail_require(cond) \ | |
if (!(cond)) { err = 1; goto bail; } |
OlderNewer