Skip to content

Instantly share code, notes, and snippets.

@shervinafshar
shervinafshar / WeLL-Dark.css
Last active March 29, 2021 03:04
A Minimal Dark CSS for WeLL Engaged
/*
Minimal tweaks to WeLL Primary Engaged style sheet[1] aiming for a dark mode.
I like Meta Pro and Meta Serif from FF Meta family[2]; former for the editor
and UI elements and the latter for posts body text. You should probably pick
your own serif and sans-serif. Uses `box-sizing` which is unsupported in IE6
and IE7. Sample screenshot are here[3].
[1]: https://user.well.com/annotated/main.html
[2]: https://www.fontshop.com/families/ff-meta
[3]: https://imgur.com/a/Wh7InRx
@shervinafshar
shervinafshar / supress-warning-idea.md
Last active February 11, 2022 01:14 — forked from vegaasen/supress-warning-idea.md
SuppressWarnings with IntelliJ Idea

Usage

Following is an example related to the usage of the various ignore capabilities.

	@SuppressWarnings("MagicCharacter")
	@SuppressWarnings("AssertStatement")
	@SuppressWarnings("AwaitWithoutCorrespondingSignal")
	@SuppressWarnings("ConstantConditions")

@SuppressWarnings("rawtypes")

@shervinafshar
shervinafshar / transfer-magicpref.sh
Created July 14, 2015 22:39
Back up and Restore Magicpref Settings
# Source machine
defaults export com.vladalexa.MagicPrefs magicpref.plist
# Target machine
defaults import com.vladalexa.MagicPrefs magicpref.plist
@shervinafshar
shervinafshar / wget-ignore-robots.sh
Created January 28, 2015 19:09
Ignore all them robot rules!
wget -e robots=off --wait 1 http://www.foo.bar
@shervinafshar
shervinafshar / CheckSetSecLabel.sh
Created July 9, 2014 08:04
Check and set the SELinux security label of the files
ls -Z
sudo chcon -Rv --type=httpd_sys_content_t folder/
@shervinafshar
shervinafshar / pytz.py
Last active August 29, 2015 14:01
Using `pytz` for conversation of time and date into other timezones.
import pytz, datetime, calendar
#import dateutil
d1 = datetime.datetime(2013, 4, 20, 7, 50, tzinfo=pytz.timezone('US/Pacific'))
d2 = datetime.datetime(2013, 4, 20, 9, 40, tzinfo=pytz.timezone('US/Pacific'))
d1Utc = d1.astimezone(pytz.timezone('UTC'))
d1UtcTs = calendar.timegm(d1.utctimetuple())
@shervinafshar
shervinafshar / TransferInstalledPerlModules
Created May 6, 2014 23:20
Install the Perl modules from one installation version into another with one command
C:\Perl-510\ppm.bat list | perl -wnE "system('C:\Perl-516\bin\ppm.bat install ' . $_ . ' --force') for /^\| (.+?)\|/g"
@shervinafshar
shervinafshar / PythonWonders.md
Last active April 27, 2021 19:26
Adventures in Pythonland.

Python Matrices:

M = [[1,2,3], [4,5,6], [7,8,9]]
# diagonal
[M[i][i] for i in len(0, len(M))]
# reverse diagonal
[M[i][-(i+1)] for i len(0, len(M)]

Translating strings

from string import maketrans
inTable = "abcde"
### Keybase proof
I hereby claim:
* I am shervinafshar on github.
* I am shervinafshar (https://keybase.io/shervinafshar) on keybase.
* I have a public key whose fingerprint is 1501 573E 214A 0691 AB4F F613 801A AA7B 118A FC2E
To claim this, I am signing this object: