Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

farhad omid frhd

🏠
Working from home
View GitHub Profile
@frhd
frhd / remove_sl_icon.sh
Created Jul 19, 2020 — forked from ulasozguler/remove_sl_icon.sh
Remove spotlight icon from menu bar.
View remove_sl_icon.sh
cd /System/Library/CoreServices/Spotlight.app/Contents/MacOS
sudo cp Spotlight Spotlight.bak
sudo perl -pi -e 's|(\x00\x00\x00\x00\x00\x00\x47\x40\x00\x00\x00\x00\x00\x00)\x42\x40(\x00\x00\x80\x3f\x00\x00\x70\x42)|$1\x00\x00$2|sg' Spotlight
cmp -l Spotlight Spotlight.bak
sudo codesign -f -s - Spotlight
sudo killall Spotlight
View css-layout-hack.js
// create a bookmark and use this code as the URL, you can now toggle the css on/off
// thanks+credit: https://dev.to/gajus/my-favorite-css-hack-32g3
javascript: (function() {
var elements = document.body.getElementsByTagName('*');
var items = [];
for (var i = 0; i < elements.length; i++) {
if (elements[i].innerHTML.indexOf('* { background:#000!important;color:#0f0!important;outline:solid #f00 1px!important; background-color: rgba(255,0,0,.2) !important; }') != -1) {
items.push(elements[i]);
}
}
@frhd
frhd / hosts
Created Feb 24, 2019 — forked from aparajita/hosts
hosts file entries to block Facebook
View hosts
# Block facebook!
0.0.0.0 static.ak.fbcdn.net
0.0.0.0 www.connect.facebook.net
0.0.0.0 www.facebook.com
0.0.0.0 www.fbcdn.com
0.0.0.0 www.fbcdn.net
0.0.0.0 www.graph.facebook.com
0.0.0.0 www.login.facebook.com
0.0.0.0 www.s-static.ak.facebook.com
0.0.0.0 www.static.ak.connect.facebook.com
@frhd
frhd / readme.md
Created Dec 21, 2017 — forked from maxogden/readme.md
automatically scan for and join open internet enabled wifi networks on linux using node.js (tested on raspberry pi raspbian)
View readme.md
@frhd
frhd / DropwizardJettyCrossOriginIntegrationTest.java
Created Jul 7, 2016 — forked from yunspace/DropwizardJettyCrossOriginIntegrationTest.java
Dropwizard 0.8.0 and 0.9.0 Jetty CORS Filter with Unit Tests. To prove this works once and for all
View DropwizardJettyCrossOriginIntegrationTest.java
import io.dropwizard.Application;
import io.dropwizard.Configuration;
import io.dropwizard.client.JerseyClientBuilder;
import io.dropwizard.setup.Environment;
import io.dropwizard.testing.junit.DropwizardAppRule;
import org.assertj.core.data.MapEntry;
import org.eclipse.jetty.servlets.CrossOriginFilter;
import org.junit.ClassRule;
import org.junit.Test;
@frhd
frhd / build.gradle
Created Apr 20, 2016 — forked from spikeheap/build.gradle
Gradle build script to install NodeJS packages and Bower dependencies. This assumes you create package.json (nodejs) and bower.json files in the root of your project.
View build.gradle
import org.gradle.api.tasks.Exec
defaultTasks 'bower'
// Get the path for the locally installed binaries
task npmBin << {
new ByteArrayOutputStream().withStream { os ->
def result = exec {
executable = 'npm'
args = ['bin']
@frhd
frhd / jsf.md
Created Mar 2, 2016 — forked from nekman/jsf.md
Don't use JSF
View jsf.md

JSF?!

http://www.thoughtworks.com/radar/#/languages-and-frameworks/683 - ThoughtWorks Technology Radar - January 2014

We continue to see teams run into trouble using JSF -- JavaServer Faces -- and are recommending you avoid this technology. Teams seem to choose JSF because it is a J2EE standard without really evaluating whether the programming model suits them. We think JSF is flawed because it tries to abstract away HTML, CSS and HTTP, exactly the reverse of what modern web frameworks do. JSF, like ASP.NET webforms, attempts to create statefulness on top of the stateless protocol HTTP and ends up causing a whole host of problems involving shared server-side state. We are aware of the improvements in JSF 2.0, but think the model is fundamentally broken. We recommend teams use simple frameworks and embrace and understand web technologies including HTTP, HTML and CSS.


http://www.jfokus.se/jfokus/talks.jsp - Search for JSF... (one hit on why you should leave it)
http://architecture-musings.blo
@frhd
frhd / readme.md
Last active Aug 29, 2015 — forked from coolaj86/how-to-publish-to-npm.md
How to publish packages to NPM
View readme.md

Getting Started with NPM (as a developer)

If you haven't already set your NPM author info, now you should:

npm set init.author.name "Your Name"
npm set init.author.email "you@example.com"
npm set init.author.url "http://yourblog.com"

npm adduser
@frhd
frhd / fancy-cli-dl.sh
Created Nov 19, 2014
fancy cli downloader
View fancy-cli-dl.sh
sudo -v && wget -nv -O- https://raw.githubusercontent.com/kovidgoyal/calibre/master/setup/linux-installer.py | sudo python -c "import sys; main=lambda:sys.stderr.write('Download failed\n'); exec(sys.stdin.read()); main()"
@frhd
frhd / du.sh
Created Sep 25, 2014
linux directory size queries
View du.sh
# total size of current dir
du -hs
# total size of all level 1 directories in current dir
du -h --max-depth=1 | sort -n | grep M