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 | |
if [ -z "$1" ]; then | |
echo "Usage $0 <url to file>" | |
exit 1 | |
fi | |
BASE_URL=$(dirname $1) | |
FILE=$(basename $1) |
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
function exec_cmd { | |
exec 3>&1 | |
error=$( { $@ 1>&3; } 2>&1 ) | |
exec 3>&- | |
if [ "${error}" ]; then | |
echo "[ERROR] ${error}" | |
exit 1 | |
fi | |
} |
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
# Varaian 1 | |
from package import module_with_some_name1, module_with_some_name2, \ | |
module_with_some_name3, module_with_some_name4, module_with_some_name5, \ | |
module_with_some_name6, module_with_some_name7 | |
# Variant 2 | |
from package import module_with_some_name1, \ | |
module_with_some_name2, \ |
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
#include <iostream> | |
#include <cstdio> // fopen, fclose, fread, fwrite, BUFSIZ | |
#include <ctime> | |
using namespace std; | |
int main() { | |
clock_t start, end; | |
start = clock(); | |
// BUFSIZE default is 8192 bytes |
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 mmap | |
import os | |
from sys import stdout | |
from sys import exit | |
# If length is 0, the maximum length of the map is the current size of the file | |
FIND_BUFFER_SIZE = 0 | |
READ_BUFFER_SIZE = 100 | |
SEARCH_STRING = "substring3.1" |
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 os | |
import sys | |
import struct | |
from collections import namedtuple | |
from ctypes import\ | |
CDLL,\ | |
CFUNCTYPE,\ | |
c_int,\ | |
c_char_p,\ |
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 pika | |
import logging | |
import pickle | |
import json | |
AMQPS = { | |
'test': { | |
'host': '127.0.0.1', | |
'port': 5672, | |
'userid': 'test', |
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
% Compile: | |
% erlc +debug_info amqp_consumer.erl; | |
% Run: | |
% erl -noshell -s amqp_consumer consume -s init stop | |
-module(amqp_consumer). | |
-export([consume/0]). | |
-include_lib("amqp_client/include/amqp_client.hrl"). |
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
Index: kernel/nv-pat.c | |
=================================================================== | |
--- kernel/nv-pat.c.orig | |
+++ kernel/nv-pat.c | |
@@ -35,8 +35,13 @@ static inline void nv_disable_caches(uns | |
unsigned long cr0 = read_cr0(); | |
write_cr0(((cr0 & (0xdfffffff)) | 0x40000000)); | |
wbinvd(); | |
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 20, 0) | |
*cr4 = read_cr4(); |
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
% erl -pa /usr/share/elixir/1.0.5/lib/*/ebin -elixir ansi_enabled true | |
application:ensure_all_started(elixir), | |
rr("/usr/share/elixir/1.0.5/lib/elixir/src/elixir.hrl"). | |
% A simplified version of 'Elixir.Code':eval_string/2 | |
% https://github.com/elixir-lang/elixir/blob/v1.2.0/lib/elixir/lib/code.ex#L159 | |
EvalString = fun(String, Binding) -> | |
% Converts a given string (char list) into quote expression | |
% https://github.com/elixir-lang/elixir/blob/v1.2.0/lib/elixir/src/elixir.erl#L252 |
OlderNewer