Skip to content

Instantly share code, notes, and snippets.

View Nihhaar's full-sized avatar
🎯
Focusing

Nihhaar_RC Nihhaar

🎯
Focusing
View GitHub Profile
@Sklavit
Sklavit / mock.methods.py
Last active November 8, 2023 09:53
Mock examples
# @ https://cheat.readthedocs.io/en/latest/python/mock.html
obj.call_count # number of times it was called
obj.called == obj.call_count > 0
obj.call_args_list # a list of (args,kwargs), one for each call
obj.call_args # obj.call_args_list[-1] (args,kwargs from last call)
obj.return_value # set to what it should return
obj.side_effect # set to an exception class or instance that should be raised when its called
obj.assert_called() # doesn't work with autospec=True? just assert obj.called
obj.assert_called_with(*args, **kwargs) # last call was with (*args, **kwargs)
@noelboss
noelboss / git-deployment.md
Last active July 16, 2024 09:50
Simple automated GIT Deployment using Hooks

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your local GIT repository to a server based on this in-depth tutorial.

How it works

You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like deepl.io to act upon a Web-Hook that's triggered that service.

#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
"""S3DistCp
Run S3DistCp via boto. Currently only a limited set of S3DistCp
options useful for preparing AWS/EMR input data are exposed.
For details of S3DistCp options, see Distributed Copy Using S3DistCP:
http://docs.aws.amazon.com/ElasticMapReduce/latest/DeveloperGuide/UsingEMR_s3distcp.html
@iamtekeste
iamtekeste / Download Google Drive files with WGET
Created July 8, 2015 11:00
Download Google Drive files with WGET
Download Google Drive files with WGET
Example Google Drive download link:
https://docs.google.com/open?id=[ID]
To download the file with WGET you need to use this link:
https://googledrive.com/host/[ID]
Example WGET command:
@gertig
gertig / Mac style drop shadow.css
Created August 23, 2012 20:38
Mac style drop shadow
box-shadow:inset 0 1px 0 rgba(255,255,255,.6), 0 22px 70px 4px rgba(0,0,0,0.56), 0 0 0 1px rgba(0, 0, 0, 0.3);
@sj26
sj26 / session_id_middleware.py
Created April 21, 2012 05:24
Session ID middleware for Python
#!/usr/bin/env python
import base64
from Cookie import SimpleCookie
import hashlib
import hmac
import random
import string
@lancejpollard
lancejpollard / meta-tags.md
Created March 5, 2012 13:54
Complete List of HTML Meta Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta name="keywords" content="your, tags"/>
<meta name="description" content="150 words"/>
<meta name="subject" content="your website's subject">
<meta name="copyright"content="company name">
<meta name="language" content="ES">
@jehiah
jehiah / simple_args_parsing.sh
Created March 4, 2011 16:56
a simple way to parse shell script arguments
#!/bin/sh
#
# a simple way to parse shell script arguments
#
# please edit and use to your hearts content
#
ENVIRONMENT="dev"