Skip to content

Instantly share code, notes, and snippets.

@zealotree
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zealotree/f491e5d7c647a902114e to your computer and use it in GitHub Desktop.
Save zealotree/f491e5d7c647a902114e to your computer and use it in GitHub Desktop.
These files make up and help run /desktops/ 2.0.
#! /bin/bash
# Convinience script to easily add a desktop entry
# add_desktop.sh path/to/image - filesystem upload (default behaviour)
# https://gist.github.com/KittyKatt/5818701
# pomf.se uploader by Kitty
# requires: curl
dest_url='http://pomf.se/upload.php'
return_url='http://a.pomf.se'
if [[ -n "${1}" ]]; then
file="${1}"
if [ -f "${file}" ]; then
printf "Making thumbnail... \n"
filename=$(basename "$file")
ext="${filename##*.}"
s_ext="png, jpg, gif"
if [[ "${s_ext}" =~ "${ext}" ]]; then
echo "${ext} is safe"
else
echo "Rejected: ext "$ext" not supported"
break
fi
if [[ "${ext}" == "gif" ]]; then
convert ${file} -coalesce -strip -quality 75 -thumbnail 531x350^ -gravity Center -extent 531x350 +repage thumb.gif
else
convert ${file} -strip -quality 75 -thumbnail 531x350^ -gravity Center -extent 531x350 +repage thumb."${ext}"
upload="thumb.png"
fi
printf "Uploading ${file}... \n"
my_output=$(curl --silent -sf -F files[]="@${file}" "${dest_url}")
printf "Uploading thumbnail... \n"
thumb=$(curl --silent -sf -F files[]="@thumb.png" "${dest_url}")
n=0 # Multipe tries
while [[ $n -le 3 ]]; do
printf "try #${n}..."
if [[ "${my_output}" =~ '"success":true,' ]]; then
return_file=$(echo "$my_output" | grep -Eo '"url":"[A-Za-z0-9]+.png",' | sed 's/"url":"//;s/",//')
printf 'done.\n'
echo $return_file
else
printf 'failed.\n'
((n = n +1))
fi
if [[ "${thumb}" =~ '"success":true,' ]]; then
thumb_return_file=$(echo "$thumb" | grep -Eo '"url":"[A-Za-z0-9]+.png",' | sed 's/"url":"//;s/",//')
echo $thumb_return_file
printf 'done.\n'
break
else
printf 'failed.\n'
((n = n +1))
fi
done
rm thumb.${ext}
if [[ -n ${return_file} ]]; then
printf "File can be found at: ${return_url}/${return_file}.\n"
else
printf 'Error! File not uploaded.\n'
fi
if [[ -n ${thumb_return_file} ]]; then
printf "Thumbnail can be found at: ${return_url}/${thumb_return_file}.\n"
else
printf 'Error! Thumbnail not uploaded.\n'
fi
else
printf 'Error! File does not exist!\n'
exit 1
fi
else
printf 'Error! You must supply a filename to upload!\n'
exit 1
fi
# create .md at generator/content/
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
DATE_TODAY=$(date "+%H:%M:%S %m/%d/%Y")
pushd generator
touch content/"$NEW_UUID".md
echo "Title: $NEW_UUID
Date: $DATE_TODAY
Tags:
Image: ${return_url}/${return_file}
Thumbnail: ${return_url}/${thumb_return_file}
content
" >> content/"$NEW_UUID".md
echo "Desktop entry added!"
echo "File: $NEW_UUID"
echo "Modfiy file? (y/n)"
read yesno
if [[ $yesno == "y" ]]; then
vim content/${NEW_UUID}.md
echo "Run update_neocities to generate and upload the new site!"
exit
fi
echo "Delete file? (y/n)"
read yesno
if [[ $yesno == "y" ]]; then
rm content/${NEW_UUID}.md
echo "File deleted"
exit
fi
#! /bin/bash
pushd generator
pelican
popd
#! /bin/bash
# update_neocities.sh
# Uploads files to neocities
# this does not upload subdirectories, yet
# NOTE: Do not save sensitive data on version control.
neocities_username=$NEOCITIES_USERNAME
neocities_password=$NEOCITIES_PASSWORD
upload_directory="output" # location of your html files live
rm -r $upload_directory/theme
find $upload_directory -type f -execdir curl --silent -F {}=@{} https://$neocities_username:$neocities_password@neocities.org/api/upload \;
echo "Site Updated!"
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = 'lazy'
SITENAME = '/desktops/'
SITEURL = 'desktops.neocities.org'
TAGLINE = "In pursuit of aesthetics & efficiency"
DEFAULT_DATE_FORMAT = '%d %B %Y'
DEFAULT_ORPHANS = 4
PATH = 'content'
OUTPUT_PATH = '../output/'
THEME = 'desktops-theme'
TIMEZONE = 'America/Toronto'
DEFAULT_LANG = 'en'
# Feed generation is usually not desired when developing
FEED_ALL_ATOM = None
FEED_ALL_RSS = None
CATEGORY_FEED_ATOM = None
TRANSLATION_FEED_ATOM = None
AUTHOR_FEED_ATOM = None
AUTHOR_FEED_RSS = None
# Social widget
SOCIAL = (('You can add links in your config file', '#'),
('Another social link', '#'),)
DISQUS_SITENAME = 'desktopss'
DEFAULT_PAGINATION = 6
# Uncomment following line if you want document-relative URLs when developing
RELATIVE_URLS = True
DELETE_OUTPUT_DIRECTORY = True
AUTHOR_SAVE_AS = ''
AUTHOR_URL = ''
CATEGORIES_SAVE_AS = ''
CATEGORY_SAVE_AS = ''
CATEGORY_URL = ''
AUTHORS_SAVE_AS = ''
TAGS_SAVE_AS = ''
TAG_SAVE_AS = 'tag_{slug}.html'
AUTHOR_URL = ''
AUTHOR_SAVE_AS = ''
ARCHIVES_SAVE_AS = ''
ARTICLE_URL = '{title[1]}{title[5]}{title[9]}{title[16]}{title[6]}{title[18]}{title[22]}{title[4]}{title[24]}.html'
ARTICLE_SAVE_AS = '{title[1]}{title[5]}{title[9]}{title[16]}{title[6]}{title[18]}{title[22]}{title[4]}{title[24]}.html'
PAGE_URL = '{slug}.html'
PAGE_SAVE_AS = '{slug}.html'
def CURRENT_YEAR(foo):
import time
return time.strftime("%Y")
def LAST_UPDATE(foo):
import time
return time.strftime("%a %H:%M %D")
JINJA_FILTERS = { 'CURRENT_YEAR' : CURRENT_YEAR, 'LAST_UPDATE' : LAST_UPDATE}
@import "susy";
@import "normalize";
@import "breakpoint";
@import url(http://fonts.googleapis.com/css?family=Open+Sans:700,300);
@import url(http://fonts.googleapis.com/css?family=Inconsolata);
@import url(http://fonts.googleapis.com/css?family=Droid+Serif);
@import url(http://fonts.googleapis.com/css?family=Inconsolata);
.hvr-shrink {
display: inline-block;
vertical-align: middle;
-webkit-transform: translateZ(0);
transform: translateZ(0);
box-shadow: 0 0 1px rgba(0, 0, 0, 0);
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
-moz-osx-font-smoothing: grayscale;
-webkit-transition-duration: 0.3s;
transition-duration: 0.3s;
-webkit-transition-property: transform;
transition-property: transform;
}
.hvr-shrink:hover, .hvr-shrink:focus, .hvr-shrink:active {
-webkit-transform: scale(0.95);
transform: scale(0.95);
}
#gallery {
-webkit-animation: fadein 3.5s; /* Safari, Chrome and Opera > 12.1 */
-moz-animation: fadein 2.5s; /* Firefox < 16 */
-ms-animation: fadein 2.5s; /* Internet Explorer */
-o-animation: fadein 2.5s; /* Opera < 12.1 */
animation: fadein 2.5s;
background: #FAFFFC;
color: #46484A;
min-height: 100%;
a {
color: #BCCBDA;
-o-transition:color .2s ease-out, background 1s ease-in;
-ms-transition:color .2s ease-out, background 1s ease-in;
-moz-transition:color .2s ease-out, background 1s ease-in;
-webkit-transition:color .2s ease-out, background 1s ease-in;
transition:color .2s ease-out, background 1s ease-in;
&:hover {
color: #888C94;
}
}
@include container(4 1120px center inside-static);
.title {
font-family: 'Open Sans', sans-serif;
@include span(full);
text-align: center;
margin-bottom: 2%;
font-size: 150%;
@include breakpoint(1000px) {
font-size: 100%;
}
}
img.logo {
width: 100%;
height: auto;
@include breakpoint(1000px) {
width: auto;
padding: 15px;
}
display: block;
margin-left: auto;
margin-right: auto }
.desktops {
@include bleed(gutter(12));
}
.page-content {
margin-left: 15%;
margin-right: 15%;
font-family: "Times New Roman", sans-serif;
font-size: 22px;
.title { font-family: "Times New Roman", sans-serif; text-align: center ; font-size: 38px; margin-bottom: 8%;}
}
.single {
@include span(full);
.view {
@include span(3 first);
display: block;
margin-top: 6.5%;
img { width: 100% ; height: auto; }
}
.info {
height: 100%;
margin-top: 6.5%;
@include span(1 last);
font-family: "Open Sans", sans-serif;
font-size: 16px;
font-weight: bold;
i { margin-right: 2%; margin-left: 2%;}
.date { @include span(full);background: #7ACCA6; color: #F1FFF1; margin-top: 0% ; margin-bottom: 0% ; padding: 4px; }
.user {
@include span(full);
background: #46484A; color: #FAFFFF;
margin-top: 0% ; margin-bottom: 0% ; padding: 4px;
p { width: 90% }
}
.source-link {
@include span(full);
background: #CBABC9; margin-top: 0% ; margin-bottom: 0% ; padding: 4px;
&:hover { background: #888C94 ;}
a {
text-decoration: none;
color: white;
&:hover { color: #F2F2F2 ;}
}
}
.permalink { @include span(full); clear: both; a {color: #5E615F; &:hover { color: #888C94;}} }
div.tags {
@include span(full);
margin-top: 5%;
ul {
list-style-type: none;
padding: 0;
font-size: 12px;
}
li {
i { color: white; };
margin-top: 3%;
border-radius: 2px;
color: white;
display: inline;
list-style-type: none;
padding: 4px;
white-space: nowrap;
background: #BCCBDA;
margin-right: 8px;
white-space: nowrap;
&:hover { color: #C6D6E6;}
a {
text-decoration: none;
color: white;
&:hover {
color: #F2F2F2;
}
}
}
}
}
.comments {
@include span(4);
#disqus_thread { @include span(full); }
}
}
#desktop {
@include span(full 2 split);
@include breakpoint(1000px) {
@include gallery(2);
}
margin-bottom: 5%;
margin-top: 5%;
.thumb {
width: 100%; height: 350px;
// -webkit-box-shadow: 0px 3px 9px 0px rgba(50, 50, 50, 0.5);
// -moz-box-shadow: 0px 3px 9px 0px rgba(50, 50, 50, 0.5);
// box-shadow: 0px 3px 9px 0px rgba(50, 50, 50, 0.5);
}
img {
width: 100%; height: 350px;
-webkit-box-shadow: 0px 3px 9px 0px rgba(50, 50, 50, 0.5);
-moz-box-shadow: 0px 3px 9px 0px rgba(50, 50, 50, 0.5);
box-shadow: 0px 3px 9px 0px rgba(50, 50, 50, 0.5);
}
.info {
font-size: 110%;
@include breakpoint(1000px) {
font-size: 90%;
}
margin-top: 6.5px;
.date {
float: right; margin: 0; padding: 2.5px; clear: left; background: #7ACCA6; color: #F1FFF1;
a { text-decoration: none; color: #F1FFF1; &:hover { text-decoration: underline}}
}
.external { margin: 0; padding: 2.5px; clear: right; background: #A2CBA0; color: #F1FFF1; }
.user { margin-right: 6px };
font-family: 'Open Sans', sans-serif;
p { float: left; margin: 0; padding: 0; }
.source-link {
color: #CBABC9;
&:hover {
color: #8AAD89;
}
}
ul {
i { color: #BCCBDA; };
float: right;
display: inline;
list-style-type: none;
padding: 0;
margin: 0;
li {
display: inline;
list-style-type: none;
padding-left: 2px;
padding-right: 2px;
}
}
}
}
@keyframes fadein {
from { opacity: 0; }
to { opacity: 1; }
}
/* Firefox < 16 */
@-moz-keyframes fadein {
from { opacity: 0; }
to { opacity: 1; }
}
/* Safari, Chrome and Opera > 12.1 */
@-webkit-keyframes fadein {
from { opacity: 0; }
to { opacity: 1; }
}
/* Internet Explorer */
@-ms-keyframes fadein {
from { opacity: 0; }
to { opacity: 1; }
}
/* Opera < 12.1 */
@-o-keyframes fadein {
from { opacity: 0; }
to { opacity: 1; }
}
footer {
div.pager {
color: #828282;
@include span(4);
display: block;
text-align: center;
.paginator { font-family: 'Open Sans', sans-serif; font-size: 14px; }
margin-bottom: 10%;
@include breakpoint(1000px) {
margin-bottom: 5%;
}
}
color: #9A9A9A;
@include span(full 2 split);
margin-top: 30%;
margin-bottom: 2%;
clear: both;
font-family: "Open Sans", sans-serif;
font-size: 80%;
@include breakpoint(1000px) {
margin-top: 10%;
margin-bottom: 2%;
font-size: 90%;
}
div.border {
margin-bottom: 5px;
margin-top: 5px;
@include breakpoint(1000px) {
font-size: 100%;
border-top: 1px solid #BDBDBD;
}
}
.top-left {
display: inline;
list-style-type: none;
padding: 0;
margin: 0;
li {
display: inline;
list-style-type: none;
padding: 0;
margin: 0;
}
}
.top-right {
display: inline;
list-style-type: none;
padding: 0;
margin: 0;
float: right;
li {
display: inline;
list-style-type: none;
padding: 0;
margin: 0;
}
}
.bottom-right {
display: inline;
list-style-type: none;
padding: 0;
margin: 0;
float: right;
li {
display: inline;
list-style-type: none;
padding: 0;
margin: 0;
}
}
.bottom-left {
display: inline;
list-style-type: none;
padding: 0;
margin: 0;
li {
display: inline;
list-style-type: none;
padding: 0;
margin: 0;
}
}
}
}
#about {
-webkit-animation: fadein 3.5s; /* Safari, Chrome and Opera > 12.1 */
-moz-animation: fadein 2.5s; /* Firefox < 16 */
-ms-animation: fadein 2.5s; /* Internet Explorer */
-o-animation: fadein 2.5s; /* Opera < 12.1 */
animation: fadein 2.5s;
min-height: 100%;
background: #5B5E6B;
color: #FAFFE7;
font-size: 100%;
@include breakpoint(1000px) {
font-size: 150%;
}
a {
-o-transition:color .2s ease-out, background 1s ease-in;
-ms-transition:color .2s ease-out, background 1s ease-in;
-moz-transition:color .2s ease-out, background 1s ease-in;
-webkit-transition:color .2s ease-out, background 1s ease-in;
transition:color .2s ease-out, background 1s ease-in;
}
.back {
position: fixed;
top: 0;
left: 0;
color: #FAFFFC;
font-family: "Open Sans", sans;
background: #7ACCA6;
padding: 3px;
font-size: 75%;
a {
color:#FAFFFC;
text-decoration: none;
&:hover {
color: white;
}
}
}
.quote {
margin-top: 10%;
margin-bottom: 10%;
font-family: "Open Sans", sans;
font-style: italic;
@include span(full 3 split);
.message { text-align: center; }
.author { text-align: right; margin-right: 130px; }
}
@include container(5 1120px center inside-static);
.content {
@include span(full);
h1, h2, h3 { font-family: 'Droid Serif', 'Times New Roman', serif; margin-top: 8%; margin-bottom: 10px; };
h1 { text-align: center; margin-bottom: 8%; margin-top: 8%;}
line-height: 1.25em;
font-family: "Open Sans", sans;
@include breakpoint(1000px) {
line-height: 1.4em;
}
p, li, h2, h3 { @include squish(5%);}
li {
p {
margin-left: 5px;
}
}
ul, ol {
margin-top: 2%;
margin-bottom: 2%;
margin-left: 2%;
}
a {
color: #CCA9BF;
&:visited {
color: #CCA9BF;
}
&:link {
color: #CCA9BF;
}
&:hover {
color: #E7D5E0;
}
}
code {
font-family: "Inconsolata", monospace;
}
blockquote {
p { font-size: 90%; }
margin-top: 1%;
margin-bottom: 1%;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment