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 color_wrap(msg, color='blue'): | |
end_color = '\033[0m' | |
color_dict = { | |
'blue': '\033[94m', | |
'green': '\033[92m', | |
'yellow': '\033[93m', | |
'red': '\033[91m', | |
'purple':'\033[95m' | |
} | |
color = color_dict.get(color) |
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 | |
curl --silent "http://httpbin.org/ip" | jq '.origin' | sed -e 's/\"//g' |
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 create_title_url( title_string ) | |
title_no_special_characters = title_string.gsub( /[^A-Za-z0-9\s]/, '') | |
title_no_special_characters.strip! | |
title_hyphens_between_words = title_no_special_characters.gsub(/\s/, '-') | |
title_downcase = title_hyphens_between_words.downcase | |
title_downcase | |
end |
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
(ns command-line-args.core | |
(:gen-class) | |
(:require [org.httpkit.client :as http] | |
[net.cgrand.enlive-html :as html]) | |
(:use clojure.java.browse) | |
(:import java.io.StringReader) | |
(:import java.lang.Integer)) | |
(def base-url "https://news.ycombinator.com") |
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
package main | |
/* | |
* Script that scrapes google front page | |
* Usage: ./google [<query>] | |
* e.g. ./google hacker news | |
*/ | |
import ( | |
"fmt" |
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 | |
while true; do { echo -e 'HTTP/1.1 200 OK\r\n'; cat index.html; } | nc -l 8080; done |
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
# one line function that reverses integers | |
reverse = lambda n: int(''.join(list(str(n))[::-1])) |
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 Tackit | |
class User | |
def initialize(user, pass) | |
@user = user | |
@pass = pass | |
@token = Token.new.find_token(@user, @pass) | |
end | |
def has_token? |
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
#include <stdio.h> | |
#include <time.h> | |
#define TIME_SIZE 100 | |
char * getcurrenttime(){ | |
char *buffer = malloc(TIME_SIZE); | |
struct tm *ts; | |
size_t size; | |
time_t timestamp = time(NULL); |