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
#!/bin/sh | |
# | |
# An example hook script to prepare the commit log message. | |
# Called by "git commit" with the name of the file that has the | |
# commit message, followed by the description of the commit | |
# message's source. The hook's purpose is to edit the commit | |
# message file. If the hook fails with a non-zero status, | |
# the commit is aborted. | |
# | |
# To enable this hook, rename this file to "prepare-commit-msg". |
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
#!/bin/bash | |
# Dependencies: | |
# imagemagick | |
# swaylock | |
# grim | |
IMAGE=/tmp/i3lock.png | |
LOCK=~/.config/sway/lock.png | |
LOCKARGS="" |
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
#[derive(Debug)] | |
struct CM { | |
id: i32, | |
topic_id: i32, | |
} | |
#[derive(Debug)] | |
struct TM { | |
id: i32, | |
} |
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
#!/bin/sh | |
# | |
# An example hook script to prepare the commit log message. | |
# Called by "git commit" with the name of the file that has the | |
# commit message, followed by the description of the commit | |
# message's source. The hook's purpose is to edit the commit | |
# message file. If the hook fails with a non-zero status, | |
# the commit is aborted. | |
# | |
# To enable this hook, rename this file to "prepare-commit-msg". |
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
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq)] | |
#[serde(rename_all="snake_case")] | |
pub enum State { | |
Pending, | |
Sending, | |
Sent, | |
Failed, | |
} | |
impl fmt::Display for State { |
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
use futures; // 0.1.26 | |
use futures::prelude::*; | |
use futures::future::{ok, err}; | |
use futures::stream::*; | |
use futures::future::FutureResult; | |
fn future_result(x: i32) -> FutureResult<i32, i32> { | |
match x { | |
1 => ok(42), |
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
use futures::future::*; | |
fn either(x: Option<i32>) -> impl Future<Item = i32, Error = i32> { | |
match x { | |
Some(x) => Either::A(ok(x).map(|x| x)), | |
None => Either::B(ok(42).and_then(|x| err(x))) | |
} | |
} | |
fn boxed(x: Option<i32>) -> Box<Future<Item = i32, Error = i32>> { |
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
Section "InputClass" | |
Identifier "touchpad" | |
Driver "synaptics" | |
MatchIsTouchpad "on" | |
Option "TapButton1" "1" | |
Option "TapButton2" "2" | |
Option "TapButton3" "3" | |
Option "VertEdgeScroll" "off" | |
Option "VertTwoFingerScroll" "on" | |
Option "HorizEdgeScroll" "off" |
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 asyncio | |
async def d(): | |
print('d start') | |
await asyncio.sleep(2) | |
print('d stop') | |
async def f(): | |
print('f start') |
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 aioredis | |
from aiohttp import web | |
async def init(app): | |
print('redis connecton') | |
app['redis'] = await aioredis.create_redis( | |
'redis://localhost', loop=app.loop) | |
async def deinit(app): |
NewerOlder