Install with git git clone https://gist.github.com/85942af486eb79118467.git ~/Pictures/wallpapers
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 strict'; | |
const EventEmitter = require('events'); | |
/** | |
* Runs generator and puts EventEmitter context in it to let user | |
* emit any events inside generator and subscribe to them from outside. | |
* | |
* @param {Function} gen Function which returns generator | |
* @return {EventEmitter} Returns emitter instance which is bound |
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
function toHex(s) { | |
var hex = ‘’; | |
for (var i=0;i<s.length;i++) { hex += ‘’+s.charCodeAt(i).toString(16); } | |
return `0x${hex}`; | |
} |
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
# Fancy Github message on terminal start (if network is up, otherwise nothing will happen) | |
echo -e "GET http://google.com HTTP/1.0\n\n" | nc google.com 80 > /dev/null 2>&1 | |
if [ $? -eq 0 ]; then | |
echo; | |
/usr/bin/curl https://api.github.com/zen | |
echo; echo; | |
fi |
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
// This Program takes in any 20-byte low register string and tells | |
// whether a string is a palindrome ignoring any spaces. | |
function main(str: [char; 20]) -> bool { | |
return is_palindrome(str); | |
} | |
function is_palindrome(str: [char; 20]) -> bool { | |
const str_len = 20u32; // saving const for convinience |
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
#[test_only] | |
module 0x0::tc_tests { | |
use sui::coin; | |
use sui::test_scenario::{Self as tc, next_tx, ctx}; | |
struct TC_TESTS has drop {} | |
fun people(): (address) { (@0xABC) } | |
#[test] |
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
module twitter::twitter { | |
use sui::object::{Self, ID, UID}; | |
use sui::tx_context::{Self, TxContext}; | |
use std::ascii::{Self, String}; | |
use sui::balance::{Self, Balance}; | |
use sui::coin::{Self, Coin}; | |
use sui::sui::SUI; | |
use sui::transfer; | |
/// The max length of a tweet |
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
module sui::publisher { | |
use std::type_name; | |
use sui::object::{Self, UID}; | |
use sui::tx_context::TxContext; | |
use sui::types; | |
use sui::bcs; | |
/// This type can only be created in the transaction that | |
/// generates a module, by consuming its one-time witness, so it | |
/// can be used to identify the address that published the package |
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
#[allow(unused_variable, unused_field)] | |
module wework::cup { | |
/// A generic Cup from the manufacturer. | |
struct Cup has key, store { | |
id: UID, | |
filled: bool | |
} | |
/// Purchase a Cup from the manufacturer. | |
public fun purchase(coin: Coin<SUI>, ctx: &mut TxContext): Cup { |
OlderNewer