Skip to content

Instantly share code, notes, and snippets.

View zhenyanghua's full-sized avatar
🐢
I may be slow to respond.

Zhenyang Hua zhenyanghua

🐢
I may be slow to respond.
View GitHub Profile
#!/bin/bash
SYSTEM_COLLECTIONURI_TRIM=`echo "${SYSTEM_COLLECTIONURI:22}"`
PROJECT_PATH="$SYSTEM_COLLECTIONURI_TRIM$SYSTEM_TEAMPROJECT/_git/$BUILD_REPOSITORY_NAME"
echo "org: $SYSTEM_COLLECTIONURI_TRIM"
echo "project: $SYSTEM_TEAMPROJECT"
echo "repo: $BUILD_REPOSITORY_NAME"
echo "path: $PROJECT_PATH"
FILECOUNT="$(find . -name packages.config | wc -l)"
echo "Found $FILECOUNT dependency file(s)."
@itzg
itzg / LoginWebFilter.java
Created April 22, 2018 13:10
Custom Spring WebFlux AuthenticationWebFilter
import org.springframework.http.HttpMethod;
import org.springframework.http.codec.ServerCodecConfigurer;
import org.springframework.security.authentication.ReactiveAuthenticationManager;
import org.springframework.security.web.server.authentication.AuthenticationWebFilter;
import org.springframework.security.web.server.util.matcher.ServerWebExchangeMatchers;
public class LoginWebFilter extends AuthenticationWebFilter {
private final ServerCodecConfigurer serverCodecConfigurer;
/**
anonymous
anonymous / index.html
Created August 25, 2016 20:10
FeatureLayer On Demand // source http://jsbin.com/hiteweyami
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
<title>FeatureLayer On Demand</title>
<link rel="stylesheet" href="https://js.arcgis.com/3.17/dijit/themes/claro/claro.css">
<link rel="stylesheet" href="https://js.arcgis.com/3.17/esri/css/esri.css">
@vielhuber
vielhuber / script.sh
Last active April 28, 2024 06:38
PostgreSQL: Backup and restore export import pg_dump with password on command line #sql
# best practice: linux
nano ~/.pgpass
*:5432:*:username:password
chmod 0600 ~/.pgpass
# best practice: windows
edit %APPDATA%\postgresql\pgpass.conf
*:5432:*:username:password
# linux
@evdokimovm
evdokimovm / index.js
Created June 19, 2016 14:10
JavaScript Convert Radians to Degrees and Degrees to Radians
// Convert from degrees to radians.
Math.radians = function(degrees) {
return degrees * Math.PI / 180;
}
Math.radians(90); // 1.5707963267948966
// Convert from radians to degrees.
Math.degrees = function(radians) {
return radians * 180 / Math.PI;
}
import { Pipe } from 'angular2/core.js';
/**
* Map to Iteratble Pipe
*
* It accepts Objects and [Maps](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map)
*
* Example:
*
* <div *ngFor="#keyValuePair of someObject | mapToIterable">
@sasxa
sasxa / emitter.service.ts
Created January 2, 2016 05:27
Angular2 Communicating between sibling components
import {Injectable, EventEmitter} from 'angular2/core';
@Injectable()
export class EmitterService {
private static _emitters: { [ID: string]: EventEmitter<any> } = {};
static get(ID: string): EventEmitter<any> {
if (!this._emitters[ID])
this._emitters[ID] = new EventEmitter();
return this._emitters[ID];
@erodewald
erodewald / 1.Prerequisites.md
Last active October 2, 2023 04:28
Reverse proxy on Windows with Apache 2.4 for Couchpotato/Sonarr

###Pre-requisites:

  1. Any version of Windows newer than XP or Server 2003.
  2. A good text editor. I recommend Sublime Text 2.
  3. If you use Sublime Text, you can get very helpful syntax highlighting while editing Apache Conf files by installing Package Control. Once fully installed and SublimeText is restarted, CTRL+SHIFT+P -> Install Package -> ApachConf (enter).
  4. This assumes you have a public domain pointing to your WAN IP. Figure that out from whatismyip.com. If you purchase a domain and use a CNAME or A-record, it can take some time for the DNS changes to propagate. I've seen anywhere from 15 mins to several hours.
  5. Within your router, you must forward port 80 to your LAN IP which hosts Apache.
@staltz
staltz / introrx.md
Last active May 9, 2024 07:59
The introduction to Reactive Programming you've been missing
@mobilemind
mobilemind / git-tag-delete-local-and-remote.sh
Last active April 30, 2024 23:36
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName