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
cur_alpha_str = "" | |
longest_alpha_str = "" | |
for letter in s: | |
if cur_alpha_str == "" or letter > cur_alpha_str[-1]: | |
cur_alpha_str += letter | |
else: | |
if len(cur_alpha_str) > len(longest_alpha_str): | |
longest_alpha_str = cur_alpha_str | |
cur_alpha_str = str(letter) |
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
cur_alpha_str = "" | |
long_alpha_str = "" | |
for c in s: | |
if len(cur_alpha_str) == 0 or c >= cur_alpha_str[-1]: | |
cur_alpha_str += str(c) | |
else: | |
if len(cur_alpha_str) > len(long_alpha_str): | |
long_alpha_str = cur_alpha_str | |
cur_alpha_str = str(c) |
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
var request = require('request'); | |
var cheerio = require('cheerio'); | |
request('https://news.google.com/', function(error, response, body) { | |
if (!error && response.statusCode == 200) { | |
getTopStories(body); | |
} else { | |
console.error(error); | |
console.error('Status Code: ' + response.statusCode); | |
} |
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 | |
function search_node { | |
NODE_ROLES=$(knife node show $1 | grep Roles | grep $2) | |
if [ "" != "$NODE_ROLES" ] | |
then | |
echo "$1" | |
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
import java.io.*; | |
//Custom java md5 implementaiton, use whatever you have available, as long as you stream bytes | |
//into it. | |
import com.twmacinta.util.MD5; | |
public class FileHash | |
{ | |
/* |
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 java.io.*; | |
//Custom java md5 implementaiton, use whatever you have available, as long as you stream bytes | |
//into it. | |
import com.twmacinta.util.MD5; | |
public class FileHash | |
{ | |
/* |
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
efuquen@ubuntest ~/Code/oss/libav (master) $ gdb ./avconv | |
GNU gdb (GDB) 7.5-ubuntu | |
Copyright (C) 2012 Free Software Foundation, Inc. | |
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> | |
This is free software: you are free to change and redistribute it. | |
There is NO WARRANTY, to the extent permitted by law. Type "show copying" | |
and "show warranty" for details. | |
This GDB was configured as "x86_64-linux-gnu". | |
For bug reporting instructions, please see: | |
<http://www.gnu.org/software/gdb/bugs/>... |
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 | |
CURRENT_BRANCH="$(git symbolic-ref HEAD | awk -F '\/' '{ print $NF }')" | |
if [[ $CURRENT_BRANCH =~ ^.*US[0-9][0-9]*$ ]]; then | |
STORY_ID="$(echo $CURRENT_BRANCH | sed 's/^.*\(US[0-9][0-9]*\)$/\1/')" | |
cat $1 | awk '{if(NR == 1) { print "'${STORY_ID}' -",$0 } else { print $0 } }' > $1.tmp | |
mv $1.tmp $1 | |
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
mport csv | |
import locale | |
import sys | |
locale.setlocale(locale.LC_ALL, '') | |
csv_filepath = sys.argv[1] | |
winners = [] | |
with open(csv_filepath, 'rb') as csvfile: |
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
" Installs vim-plug. | |
if empty(glob('~/.vim/autoload/plug.vim')) | |
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs | |
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim | |
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC | |
endif | |
" Specify a directory for plugins | |
" - For Neovim: ~/.local/share/nvim/plugged | |
" - Avoid using standard Vim directory names like 'plugin' |