Skip to content

Instantly share code, notes, and snippets.

View yv84's full-sized avatar
๐Ÿ’
Focusing

Vladimir Yudintsev yv84

๐Ÿ’
Focusing
View GitHub Profile
@jhjguxin
jhjguxin / nginx-403-forbidden-error-hosting-in-user-home-directory.md
Created August 12, 2013 05:40
nginx 403 forbidden error when server static file under user home directory
@sachin-handiekar
sachin-handiekar / pom.xml
Created August 26, 2013 15:11
CXF Codegen plugin - WSDL2Java
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${cxf.version}</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>${basedir}/target/generated/src/main/java</sourceRoot>
@stuart-marks
stuart-marks / DynamicFiltering.java
Created April 8, 2014 00:12
Dynamic filtering using Java 8 streams.
import java.util.*;
import java.util.function.*;
import java.util.stream.*;
import static java.util.stream.Collectors.*;
import static java.util.Comparator.*;
/**
* http://stackoverflow.com/questions/22845574/how-to-dynamically-do-filtering-in-java-8
*
@yv84
yv84 / loan.py
Last active June 8, 2017 03:33
loan
def differ(loan, rate, t, accuracy=2):
list_pay_per_month = []
body_of_loan = loan
month_count = t * 12
body_per_month = loan / month_count
sum = 0
for _ in range(month_count):
interest = body_of_loan * rate / 12
pay_per_month = interest + body_per_month
@huskercane
huskercane / python_java_time.py
Created July 29, 2014 15:08
Convert from java timestamp to python datetime and vice versa
def _convert_java_millis(java_time_millis):
"""Provided a java timestamp convert it into python date time object"""
ds = datetime.datetime.fromtimestamp(
int(str(java_time_millis)[:10])) if java_time_millis else None
ds = ds.replace(hour=ds.hour,minute=ds.minute,second=ds.second,microsecond=int(str(java_time_millis)[10:]) * 1000)
return ds
def _convert_datetime_java_millis(st):
"""Provided a python datetime object convert it into java millis"""
@JarenGlover
JarenGlover / gist:d7ffab312ea756834218
Last active August 9, 2024 06:08
Nginx - Reverse Proxy | Backend & Front End Example
upstream fuel {
# Defines a group of servers. Servers can listen on different ports.
server IP:PORT fail_timeout=0;
}
upstream frontend {
server IP:PORT fail_timeout=0;
}
@soucekv
soucekv / build.gradle
Last active July 26, 2024 22:37
Gradle checkstyle with suppression filter module
//Gist note this is snippet from root build.gradle in project with subprojects
checkstyle {
// use one common config file for all subprojects
configFile = project(':').file('config/checkstyle/checkstyle.xml')
configProperties = [ "suppressionFile" : project(':').file('config/checkstyle/suppressions.xml')]
}
@yv84
yv84 / replacer.py
Last active February 19, 2018 10:02 — forked from meddulla/replacer.py
Script to recursively replace string in filename and contents
"""
Usage: python script.py search_string replace_string dir
Eg. python batchreplace.py galleries productions /Sites/cjc/application/modules/productions/
And it will search recursively in dir
and replace search_string in contents
and in filenames.
Case-sensitive
"""
from sys import argv
@blaisep
blaisep / jenkins-pipeline-git-cred.md
Created October 20, 2016 23:33
Insert git credentials into Jenkins Pipeline Script projects

Suppose you want to inject a credential into a Pipeline script. The cloudbees note does not include Pipeline script examples. https://support.cloudbees.com/hc/en-us/articles/203802500-Injecting-Secrets-into-Jenkins-Build-Jobs

The Jenkins Pipeline Docs' description of the git pushmethod doesn't have an example using injected credentials. (https://jenkins.io/doc/pipeline/examples/#push-git-repo)

The Snippet generator is helpful, but not not if you try to follow the instructions at: https://wiki.jenkins-ci.org/display/JENKINS/Credentials+Binding+Plugin

@nameoftherose
nameoftherose / tk_async_demo.py
Created November 17, 2016 18:14
embedding tkinter in asyncio
# This demo is a transliteration of the below referenced demo to use the async/await syntax
#
#https://www.reddit.com/r/Python/comments/33ecpl/neat_discovery_how_to_combine_asyncio_and_tkinter/
#
# For testing purposes you may use the following command to create a test daemon:
# tail -f /var/log/messages | nc -l 5900
# Enter localhost:5900 in the entry box to connect to it.
from tkinter import *