Skip to content

Instantly share code, notes, and snippets.

View attacomsian's full-sized avatar
🌱
Fore Studio

Atta ✨ attacomsian

🌱
Fore Studio
View GitHub Profile
@TomTasche
TomTasche / nginx.conf
Last active January 27, 2023 21:22
config for nginx to proxy a specific path to an S3 bucket
# copied from default config
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
@Sharabaddin
Sharabaddin / fastfix
Last active November 7, 2021 17:36
java.sql.SQLException: The server time zone value 'EEST' is unrecognized or represents more than one time zone
ERROR: java.sql.SQLException: The server time zone value 'EEST' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.
SOLVE:
1. sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
2. add after line [mysqld]
default_time_zone='+03:00'
3. ctrl+o
4. ctrl+x
5. sudo service mysql restart
@maheshwaghmare
maheshwaghmare / social-share-url-patterns.txt
Created May 13, 2017 09:54
Social Share URL Patterns. E.g. Facebook, Twitter, Google+, Pintrest, LinkedIn, Buffer, Digg etc.
Sharer : https://www.facebook.com/sharer.php?u={url}
Twitter : https://twitter.com/intent/tweet?url={url}&text={title}&via={via}&hashtags={hashtags}
Google : https://plus.google.com/share?url={url}
Pinterest : https://pinterest.com/pin/create/bookmarklet/?media={img}&url={url}&is_video={is_video}&description={title}
LinkedIn : https://www.linkedin.com/shareArticle?url={url}&title={title}
Buffer : https://buffer.com/add?text={title}&url={url}
Digg : http://digg.com/submit?url={url}&title={title}
Tumblr : https://www.tumblr.com/widgets/share/tool?canonicalUrl={url}&title={title}&caption={desc}
Reddit : https://reddit.com/submit?url={url}&title={title}
StumbleUpon : http://www.stumbleupon.com/submit?url={url}&title={title}
@jecyhw
jecyhw / AjaxAwareAuthenticationEntryPoint.java
Last active February 10, 2022 05:59
spring boot ajax session timeout
public class AjaxAwareAuthenticationEntryPoint extends LoginUrlAuthenticationEntryPoint {
public AjaxAwareAuthenticationEntryPoint(String loginFormUrl) {
super(loginFormUrl);
}
@Override
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException, ServletException {
String ajaxHeader = ((HttpServletRequest) request).getHeader("X-Requested-With");
if ("XMLHttpRequest".equals(ajaxHeader)) {
response.sendError(HttpServletResponse.SC_FORBIDDEN, "Ajax Request Denied (Session Expired)");
@saadtazi
saadtazi / app.js
Created July 19, 2016 11:52
passport multiple strategies
const express = require('express');
const cons = require('consolidate');
const bodyParser = require('body-parser');
const cookieParser = require('cookie-parser');
const session = require('express-session');
const passport = require('passport');
const FacebookStrategy = require('passport-facebook').Strategy;
const LocalStrategy = require('passport-local').Strategy;
const ensureLoggedIn = require('connect-ensure-login').ensureLoggedIn;
@cvan
cvan / HOWTO.md
Last active May 7, 2024 15:23
How to serve a custom HTTPS domain on GitHub Pages with CloudFlare: *FREE*, secure and performant by default

Instructions

CloudFlare is an awesome reverse cache proxy and CDN that provides DNS, free HTTPS (TLS) support, best-in-class performance settings (gzip, SDCH, HTTP/2, sane Cache-Control and E-Tag headers, etc.), minification, etc.

  1. Make sure you have registered a domain name.
  2. Sign up for CloudFlare and create an account for your domain.
  3. In your domain registrar's admin panel, point the nameservers to CloudFlare's (refer to this awesome list of links for instructions for various registrars).
  4. From the CloudFlare settings for that domain, enable HTTPS/SSL and set up a Page Rule to force HTTPS redirects. (If you want to get fancy, you can also enable automatic minification for text-based assets [HTML/CSS/JS/SVG/etc.], which is a pretty cool feature if you don't want already have a build step for minification.)
  5. If you
@hootlex
hootlex / laravellocal.md
Last active May 3, 2024 08:06
Run laravel project locally

##Windows users:

cmder will be refered as console

##Mac Os, Ubuntu and windows users continue here:

  • Create a database locally named homestead utf8_general_ci
@v0lkan
v0lkan / nginx.conf
Last active April 2, 2024 18:25
Configuring NGINX for Maximum Throughput Under High Concurrency
user web;
# One worker process per CPU core.
worker_processes 8;
# Also set
# /etc/security/limits.conf
# web soft nofile 65535
# web hard nofile 65535
# /etc/default/nginx
@mlvea
mlvea / currencies.json
Created March 17, 2015 16:07
Common currencies as an array
[
{
"symbol": "$",
"name": "US Dollar",
"symbol_native": "$",
"decimal_digits": 2,
"rounding": 0,
"code": "USD",
"name_plural": "US dollars"
},
@gabrielbauman
gabrielbauman / CardType.java
Last active December 13, 2023 04:21
A Java enum representing credit card types (Visa, Mastercard etc) that can detect card type from a credit card number.
package com.gabrielbauman.gist;
import java.util.regex.Pattern;
public enum CardType {
UNKNOWN,
VISA("^4[0-9]{12}(?:[0-9]{3}){0,2}$"),
MASTERCARD("^(?:5[1-5]|2(?!2([01]|20)|7(2[1-9]|3))[2-7])\\d{14}$"),
AMERICAN_EXPRESS("^3[47][0-9]{13}$"),