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
def pop(initial_state, time): | |
state_cnt = [initial_state.count(i) for i in range(0, 9)] | |
for _ in range(0, time): | |
state_cnt = state_cnt[1:] + state_cnt[:1] | |
state_cnt[6] += state_cnt[8] | |
return sum(state_cnt) | |
def partOne(data): | |
return pop(data, 80) |
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
pub const Box = struct { | |
field: i32, | |
}; | |
pub fn main() void { | |
var box = Box { .field = 0 }; | |
box.*.field = 1; // crash aici | |
var boxPtr = &box; |
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
#!/usr/bin/env bash | |
# | |
# Register a new deploy-key on Bitbucket | |
# | |
# Usage: ./bitbucket-deploy-key.sh <username> <password> key-test ~/.ssh/id_rsa.pub vimishor my-super-repo | |
# | |
USERNAME=$1 | |
PASSWORD=$2 |
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
#!/usr/bin/env sh | |
# | |
# Search packagist.org from CLI with support for sorting results by the number | |
# of downloads or favorites. | |
# | |
# Temporary solution for https://github.com/composer/packagist/issues/365 | |
# | |
# Dependencies: | |
# - [curl](http://curl.haxx.se/) | |
# - [jq](http://stedolan.github.io/jq/) |
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 | |
# | |
# Prevents debug traces and sensitive data to be commited. | |
# | |
# What to search for | |
FUNCTIONS='var_dump\(|phpinfo\(|print_r\(' | |
# Prevent the commit if something is found. | |
# default: true |
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 | |
# Build Zsh from sources on Ubuntu. | |
# From http://zsh.sourceforge.net/Arc/git.html and sources INSTALL file. | |
# Some packages may be missing | |
sudo apt-get install -y git-core gcc make autoconf yodl libncursesw5-dev texinfo | |
git clone git://zsh.git.sf.net/gitroot/zsh/zsh | |
cd zsh |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Deploy in progress. Please try again in few minutes</title> | |
<style type="text/css" /> | |
body {color: #666; text-align: center; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; sans-serif; margin:0; width: 800px; margin: auto; font-size: 14px; } | |
h1 { font-size: 56px; line-height: 100px; font-weight: normal; color: #456; } | |
h2 { font-size: 24px; color: #666; line-height: 1.5em; } | |
h3 { color: #456; font-size: 20px; font-weight: normal; line-height: 28px; } | |
hr { margin: 18px 0; border: 0; border-top: 1px solid #EEE; border-bottom: 1px solid white; } |
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
<?php | |
// src/Foobar/Controller/FooController.php | |
namespace Foobar\Controller; | |
class FooController | |
{ | |
public function helloAction($request) | |
{ |
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
sudo add-apt-repository "deb http://archive.canonical.com/ $(lsb_release -sc) partner" | |
sudo apt-get update | |
sudo apt-get install skype && sudo apt-get -f install |
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
// paste in address bar | |
data:text/html,<title>Browser Editor</title><style type="text/css">#e{font-size: 16px; position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/javascript");</script> |
NewerOlder