Skip to content

Instantly share code, notes, and snippets.

View excitoon's full-sized avatar

Vladimir Chebotarev excitoon

View GitHub Profile
Dump of assembler code for function pthread_rwlock_rdlock:
0x00007f702fc87140 <+0>: nop
0x00007f702fc87141 <+1>: xor %r10,%r10
0x00007f702fc87144 <+4>: mov $0x1,%esi
0x00007f702fc87149 <+9>: xor %eax,%eax
0x00007f702fc8714b <+11>: lock cmpxchg %esi,(%rdi)
0x00007f702fc8714f <+15>: jne 0x7f702fc871aa <pthread_rwlock_rdlock+106>
0x00007f702fc87151 <+17>: mov 0x18(%rdi),%eax
=> 0x00007f702fc87154 <+20>: test %eax,%eax
0x00007f702fc87156 <+22>: jne 0x7f702fc871b4 <pthread_rwlock_rdlock+116>
@excitoon
excitoon / AutoHotKey script - Always-on-top.ahk
Created February 14, 2020 16:32 — forked from gustavomdsantos/AutoHotKey script - Always-on-top.ahk
AutoHotKey script that make any window Always-on-Top on Windows.
; Press Ctrl+Shift+Space to set any currently active window to be always on top.
; Press Ctrl+Shift+Space again set the window to no longer be always on top.
; Source: https://www.howtogeek.com/196958/the-3-best-ways-to-make-a-window-always-on-top-on-windows
^+SPACE::
WinGetTitle, activeWindow, A
if IsWindowAlwaysOnTop(activeWindow) {
notificationMessage := "The window """ . activeWindow . """ is now always on top."
notificationIcon := 16 + 1 ; No notification sound (16) + Info icon (1)
}
@excitoon
excitoon / gmail_to_slack.js
Created January 9, 2020 13:24 — forked from andrewmwilson/gmail_to_slack.js
Google Apps Script: Send Gmail emails to Slack
// You will also need to create a gmail filter to add the 'send-to-slack' label
// to any emails you want sent to slack
function sendEmailsToSlack() {
var label = GmailApp.getUserLabelByName('send-to-slack');
var messages = [];
var threads = label.getThreads();
for (var i = 0; i < threads.length; i++) {
messages = messages.concat(threads[i].getMessages())
@excitoon
excitoon / Python3 HTTP Server.py
Created April 23, 2019 04:51 — forked from Integralist/Python3 HTTP Server.py
Python3 HTTP Server.py
import time
from http.server import BaseHTTPRequestHandler, HTTPServer
HOST_NAME = 'localhost'
PORT_NUMBER = 9000
class MyHandler(BaseHTTPRequestHandler):
def do_HEAD(self):
self.send_response(200)

Чем выше - тем меньше.

Название Оператор
лямбда-функция lambda a: b
тернарный оператор x if y else z
логическое ИЛИ x or y
логическое И x and y
логическое НЕ not x
принадлежность
идентичность
сравнения
x in y
x not in y
x is y
x is not y
x < y
x <= y
x > y
x >= y
x != y
x == y
@excitoon
excitoon / blakefiler.py
Created June 29, 2018 11:05 — forked from jart/blakefiler.py
Demo video: https://youtu.be/gQidLhPVn70 This is a "proof of concept experiment prototype" for turning bazel query --output=build //tensorflow:libtensorflow_framework.so into an isomorphic Makefile
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@excitoon
excitoon / dummy-web-server.py
Created May 31, 2018 10:31 — forked from bradmontgomery/dummy-web-server.py
a minimal http server in python. Responds to GET, HEAD, POST requests, but will fail on anything else.
#!/usr/bin/env python
"""
Very simple HTTP server in python.
Usage::
./dummy-web-server.py [<port>]
Send a GET request::
curl http://localhost
@excitoon
excitoon / latency.txt
Created November 25, 2017 21:11 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD