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
| class SwitchSign(Exception): | |
| pass | |
| class BreakOut(Exception): | |
| pass | |
| def inner(): | |
| coef = 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
| #!/bin/bash | |
| function get_new_names() { | |
| local input_names=$1 | |
| sed 's/[ \t]\+/:/g' $input_names | |
| } | |
| function gen_subst_func() { | |
| local from=$1 | |
| local to=$2 |
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
| class AsyncFileWrapper(object): | |
| DEFAULT_BLOCK_SIZE = 8192 | |
| def __init__(self, loop=None, filename=None, | |
| fileobj=None, mode='rb'): | |
| if (filename is None and fileobj is None) or \ | |
| (filename is not None and fileobj is not None): | |
| raise RuntimeError('Confilicting arguments') | |
| if filename is not None: |
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 logging | |
| from pelican import signals | |
| from pelican import contents | |
| logger = logging.getLogger(__name__) | |
| def initialized(pelican): | |
| from pelican.settings import DEFAULT_CONFIG |
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 asyncdispatch, math | |
| randomize() | |
| proc r1() {.async.} = | |
| echo("r1 going to sleep....") | |
| await sleepAsync(random(1000) + 500) | |
| if true: | |
| raise newException(ValueError, "Oops!") | |
| echo("r1 is awake.") |
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
| var dc = new DataCollection(); | |
| dc.add("ID", "45115"); | |
| Server.sendRequest("SupportOppose.voteOppose", dc, function(res) { console.log(res); }); |
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/sh | |
| export CLIENT_ID="client-id" \ | |
| CLIENT_SECRET="client-secret" \ | |
| TOKEN_FILE="$HOME/.clarifai_token" | |
| export TOKEN_API="https://api.clarifai.com/v1/token" \ | |
| TAG_API="https://api.clarifai.com/v1/tag" |
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
| local GPG_AGENT_BIN=/usr/bin/gpg-agent | |
| local GPG_AGENT_ENV="$HOME/.gnupg/gpg-agent.env" | |
| local GPG_CONNECT_AGENT_ERR_MSG="gpg-connect-agent: no gpg-agent running in this session" | |
| function start_agent_withssh { | |
| ${GPG_AGENT_BIN} --quiet --enable-ssh-support --daemon 2> /dev/null > "${GPG_AGENT_ENV}" | |
| chmod 600 "${GPG_AGENT_ENV}" |
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
| if exists('g:dummy_chan') | |
| silent! call ch_close(g:dummy_chan) | |
| endif | |
| function! DummyCB(chan, msg) | |
| echom '>>>> msg: ' . string(a:msg) | |
| endfunction | |
| let g:dummy_chan = ch_open('127.0.0.1:9999', | |
| \ {'mode': 'json', |
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! SpawnBufferWindow(name) | |
| let dummy_buf = bufnr(a:name, v:true) | |
| call setbufvar(dummy_buf, '&buftype', 'nofile') | |
| call setbufvar(dummy_buf, '&bufhidden', 'hide') | |
| call setbufvar(dummy_buf, '&swapfile', 0) | |
| call setbufvar(dummy_buf, '&buflisted', 1) | |
| execute 'belowright vertical split #' . dummy_buf | |
| endfunction |