-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.json
34 lines (34 loc) · 4.1 KB
/
index.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
{
"macos-icon": {
"title": "Creating a macOS user icon that blends with your background",
"excerpt": "How to generate a macOS user icon that blends in with the login or desktop background.",
"image": "https://sumanthratna.ml/images/blog/macos-icon.png",
"date": "April 10, 2020",
"comments": [],
"contents": "<p>I'm a macOS user. I really only have one complaint (it's actually very minor): there's no simple default login icon, like the typical lifeless gray/white/blue person. I decided that I wanted my icon to completely blend in with the login background. There was only one problem—I had no idea how to do this. </p> <p>I decided to actually figure this out since the red rose was bothering me. I came up with the following (horribly inefficient) psuedocode/algorithm to do this: <ol> <li>take a screenshot of the login page and name it <code>log.png</code></li> <li>take a screenshot of your home page and name it <code>desk.png</code></li> <li>in Preview, use the ellipse selection tool to select the current/bad icon in <code>log.png</code></li> <li>in Preview, copy the icon with ⌘-C, paste it onto <code>desk.png</code>, and save this to a new file called <code>newdesk.png</code></li> <li>in Python, subtract <code>newdesk</code> and <code>desk</code> (this should leave an image array with many zeroes and some non-zero numbers where the old icon was)—name this new array <code>sub</code></li> <li>in Python, convert <code>sub</code> into a binary mask by setting all non-zero pixels to 1, name the mask <code>mask</code></li> <li>load either <code>log</code> or <code>desk</code> (your choice) into a variable named <code>final</code> and set <code>final</code> to zero when <code>mask</code> is 0</li> <li>save <code>final</code> to <code>final.png</code></li> <li>in Preview, use the ellipse selection tool to select the new/good icon in <code>final.png</code>, click crop, and save this to a new file called <code>icon.png</code></li> </ol> </p> <p> This resulted in the following Python code (<code>numpy 1.18.2</code> and <code>Pillow 7.1.1</code>):<br> <script src=\"https://gist.github.com/sumanthratna/8958b9e62f61cc3b9746e3f79634ee5d.js?file=user_icon.py\"></script> </p> <p> I'm sure this can be made much more efficient with advanced N-dimensional array indexing, but that usually sacrifices code readability. Please contact me if you have ideas on how to make this faster! Note: the final product isn't perfect. </p>"
},
"curl-box": {
"title": "How to download a Box file from the command line",
"excerpt": "How to download a Box file (even private files) using <code>curl</code>.",
"image": "https://sumanthratna.ml/images/blog/curl-box.png",
"date": "June 20, 2019",
"comments": [],
"contents": "<kbd>curl -L https://api.box.com/2.0/files/[FILE_ID]/content -H \"Authorization: Bearer [DEVELOPER_TOKEN]\" -o [FILE_NAME]</kbd> First get the file ID from the URL in the browser. Then get the developer token by <a href=\"https://app.box.com/developers/console\">creating a new Box app</a> (click the configuration tab). You can choose the file name to output to. View an example <a href=\"https://asciinema.org/a/V1NJDw4M8RJvVVVioTIw5qa4j\">here</a>."
},
"what-is-this": {
"title": "this",
"excerpt": "My personal website",
"image": "https://sumanthratna.ml/images/blog/what-is-this.jpg",
"date": "March 7, 2019",
"comments": [],
"contents": "This is my personal website."
},
"grade-view": {
"title": "GradeView",
"excerpt": "My grades app for Fairfax County Public Schools.",
"image": "https://sumanthratna.ml/images/blog/grade-view.png",
"date": "April 17, 2019",
"comments": [],
"contents": "If you have questions about the app, please <a href={'https://'|cat:$smarty.server.SERVER_NAME|cat:'/contact'}>contact me</a>. If you'd like, you can open an issue or pull request on the <a href=\"https://github.com/sumanthratna/grade-view.git\">GitHub repository</a>. <a href=\"https://gradeview.en.aptoide.com/\">Android</a>"
}
}