Skip to content

Instantly share code, notes, and snippets.

View rename_ordered_by_time.sh
#!/bin/bash
n=0; ls -tr | while read i; do n=$((n+1)); mv -- "$i" "$(printf '%03d' "$n").JPG"; done
View .bash_profile
[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
export NVM_DIR="$HOME/.nvm"
. "$(brew --prefix nvm)/nvm.sh"
# Git-bash-prompt
if [ -f "$(brew --prefix bash-git-prompt)/share/gitprompt.sh" ]; then
View ip_db.service
[Unit]
Description=Download IP Geolocation Database from Maxmind.com
[Service]
Type=oneshot
WorkingDirectory=/tmp
ExecStart=/bin/sh -c "\
mkdir -p /home/core/ip_database \
curl -O http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz ; \
gunzip GeoLite2-City.mmdb.gz ; \
curl -O http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.md5 ; \
@Andsbf
Andsbf / git_ignore_ds_store.md
Last active Dec 3, 2015
Make Git always ignore .DS_store file
View git_ignore_ds_store.md

Make Git never ask you again about .DS_Store

In the terminal:

echo .DS_Store > ~/.gitignore_global

Now tell git to use it for all repositories:

git config --global core.excludesfile ~/.gitignore_global

@Andsbf
Andsbf / 01_hello_world.js
Last active Aug 29, 2015
Learnyounode - I
View 01_hello_world.js
console.log("HELLO WORLD")
View bet_game.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Bet game</title>
<meta name="description" content="Bet gamed">
<meta name="author" content="Anderson">
</head>
View arrayOfLight.js
var output = []
var arrayOfLight = function (x) {
for (i = 0; i <= x; i++){
output.push(i);
}
return output;
@Andsbf
Andsbf / FailingIfStatement.js
Last active Aug 29, 2015
W6D1 Debugging Exercises
View FailingIfStatement.js
// Why does this fail?
var a = 0;
//if comparator was using equal only '='
if (a === 1) {
console.log("I Shouldn't be in here!");
} else {
console.log("I Should be in here!");
}
@Andsbf
Andsbf / Select_statments.sql
Created Mar 17, 2015
Bookstore SQL Assignment
View Select_statments.sql
-- double dash is comment in SQL
--################ Exercise 5 ################
SELECT e.isbn, b.title, s.stock, s.retail,
CASE e.type
WHEN 'p' THEN 'Paperback'
WHEN 'h' THEN 'Hardcover'
END AS cover
FROM editions AS e INNER JOIN publishers AS p ON (e.publisher_id = p.id)
@Andsbf
Andsbf / comment.rb
Last active Aug 29, 2015
Web Scrapper Exercise
View comment.rb
class Comment
attr_accessor :content
def initialize (content)
@content = content
end
end